{"id":36399362,"url":"https://github.com/payvision-development/payvision-sdk-php","last_synced_at":"2026-01-11T16:02:13.511Z","repository":{"id":57036929,"uuid":"172881827","full_name":"payvision-development/payvision-sdk-php","owner":"payvision-development","description":"This is the official PHP SDK for the Payvision payments platform. ","archived":false,"fork":false,"pushed_at":"2021-06-09T09:52:05.000Z","size":485,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-13T22:53:15.747Z","etag":null,"topics":["payvision","php","sdk","sdk-php"],"latest_commit_sha":null,"homepage":"https://www.payvision.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/payvision-development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2019-02-27T09:10:25.000Z","updated_at":"2023-08-24T14:55:13.000Z","dependencies_parsed_at":"2022-08-23T21:00:24.986Z","dependency_job_id":null,"html_url":"https://github.com/payvision-development/payvision-sdk-php","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/payvision-development/payvision-sdk-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/payvision-development%2Fpayvision-sdk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/payvision-development%2Fpayvision-sdk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/payvision-development%2Fpayvision-sdk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/payvision-development%2Fpayvision-sdk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/payvision-development","download_url":"https://codeload.github.com/payvision-development/payvision-sdk-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/payvision-development%2Fpayvision-sdk-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28312149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["payvision","php","sdk","sdk-php"],"created_at":"2026-01-11T16:02:12.603Z","updated_at":"2026-01-11T16:02:13.345Z","avatar_url":"https://github.com/payvision-development.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Payvision PHP SDK\n\n\u003e Codebase for Payvision PHP SDK\n\nThis is the official PHP SDK for the Payvision payment platform (\u003chttps://www.payvision.com\u003e).\nIt can be used to make use of the following features of the Payvision API:\n\n- Payments\n    - Make payment requests\n    - Make capture requests\n    - Make cancel requests\n    - Make refund requests\n    - Get transaction status updates\n- Paymentlink\n    - Make new paymentlink\n    - Get status of existing paymentlink\n    - Cancel existing paymentlink\n- Checkout\n    - Initialize new checkout\n    - Get checkout status\n- Webhooks\n    - Convert RAW webhook data to the proper objects\n\n## Install\n\nThis package can be installed using Composer:\n\n    composer require payvision/payvision-sdk-php\n\n## Usage\n\n### Initialize the API\n\nTo initialize the API Connection, refer to the following code snippet:\n\n    use Payvision\\SDK\\Infrastructure\\ApiConnection;\n\n    $apiConnection = new ApiConnection(\n        'username',\n        'password',\n        ApiConnection::URI_TEST,    // =URL to connect to, optional\n        false                       // debug mode, see debugging\n    );\n\n#### Debugging the API\n\nThe API uses the [Guzzle HTTP Client](http://docs.guzzlephp.org/en/stable/). \nThe debug-property is passed through to the Guzzle Client. See \n\u003chttp://docs.guzzlephp.org/en/stable/request-options.html#debug\u003e for more \ninformation about debugging.\n\n### Creating a request\n\nThe PHP SDK is a direct reflection of how the JSON structure of the requests\nand responses are typically built for the Payvision API.\n\nFor example, a typical payment request to the Payvision API would require\na JSON body like this:\n\n    {\n      \"header\" : {\n        \"businessId\" : \"{businessId}\"\n      },\n      \"action\" : \"authorize\",\n      \"body\" : {\n        \"card\" : {\n          \"holderName\" : \"John Doe\",\n          \"number\" : \"4111111111111111\",\n          \"expiryMonth\" : \"03\",\n          \"expiryYear\" : \"2020\"\n        },\n        \"transaction\" : {\n          \"amount\" : \"1.00\",\n          \"brandId\" : \"1010\",\n          \"trackingCode\" : \"7F4BFD5D-55E4-4775-81F7-0784188876C7\",\n          \"currencyCode\" : \"EUR\"\n        }\n      }\n    }\n    \nTo create this identical request using the PHP SDK, you can use one of\nthe composite builders:\n\n    use Payvision\\SDK\\Domain\\Payments\\Service\\Builder\\Composite\\Payment\\Request as PaymentRequestBuilder;\n    use Payvision\\SDK\\Domain\\Payments\\ValueObject\\Payment\\Request as PaymentRequest;\n\n    /** @var $paymentRequestBuilder PaymentRequestBuilder */\n    $paymentRequestBuilder-\u003eheader()-\u003esetBusinessId('{businessId}');\n    $paymentRequestBuilder-\u003ebody()-\u003ecard()\n        -\u003esetHolderName('John Doe')\n        -\u003esetNumber('4111111111111111')\n        -\u003esetExpiryMonth(3)\n        -\u003esetExpiryYear(2020)\n    $paymentRequestBuilder-\u003ebody()-\u003etransaction()\n        -\u003esetAmount(1.00)\n        -\u003esetBrandId(1010)\n        -\u003esetTrackingCode('7F4BFD5D-55E4-4775-81F7-0784188876C7')\n        -\u003esetCurrencyCode('EUR');\n    $paymentRequestBuilder-\u003esetAction(PaymentRequest::ACTION_AUTHORIZE);\n    $requestObject = $paymentRequestBuilder-\u003ebuild();\n    \nAt this point, you have a PHP representation of the JSON object that is to\nbe sent to the API, but it is not yet the actual request. For example: we \nstill need to know the URL where it needs to be sent to, and what kind of\nresponse we can expect from the API. \n\nTo do this we need to transform our payment request to an API request:\n    \n    use Payvision\\SDK\\Application\\Payments\\Service\\RequestBuilder;    \n    $apiRequest = RequestBuilder::newPayment($requestObject);\n    \nNow we have an API Request that we can execute using our API Connection:\n\n    $requestHeaders = []; // Optional request headers\n    $apiResponse = $apiConnection-\u003eexecute($apiRequest, $requestHeaders);\n\n#### About builders\n\nIt is **strongly recommended** that you always use the builders provided\nby the SDK to create your objects, and never directly instantiate them. \nThe reason behind this is that the method signature of the \nconstructor call of a value object can change quite often as the API\nspecification grows. This can quickly lead to backward compatible breaking\nchanges in your code. Builders overcome this problem by abstracting the\ncreation of value objects. And they're also a lot cleaner to work with.\n\n#### Handling an array as response\n\nSome API endpoints will not return a single object, but rather an array\nof objects. The [GET payments](https://developers.acehubpaymentservices.com/v3.3/reference#get-payment-by-tracking-code-2)\nendpoint is an example of this.\n\nIn this case, where you as a developer know that you can expect an array\nas a result, you need to use the `ApiConnection::executeAndReturnArray()`-method\ninstead of the `execute()`-method:\n\n    $apiRequest = RequestBuilder::getPayments($businessId, $trackingCode);\n    $apiResponses = $apiConnection-\u003eexecuteAndReturnArray($apiRequest);\n    $apiResponse = $apiResponses[0]; // for example\n    \n### Handling the responses\n\nThe `$apiResponse` in the above example is an object of the type that is\ndefined in the request. To know what kind of type this is, you can use \n`$apiRequest-\u003egetResponseObjectByStatusCode(200)`.\n\nIf the API returns a non-2XX status, an exception is thrown of the type\n`Payvision\\SDK\\Exception\\Api\\ErrorResponse`. This exception has the \nerror object with more information about what went wrong:\n\n    try {\n        $apiResponse = $apiConnection-\u003eexecute($apiRequest);\n    } catch (ErrorResponse $errorResponseException) {\n        /** \\Payvision\\SDK\\Domain\\Payments\\ValueObject\\Payment\\Response $apiResponse */\n        $errorResponse = $errorResponseException-\u003egetErrorResponse();\n    }\n\n## Webhooks\n\nWebhooks can also be handled by the SDK. In order to do so you need the \nfollowing input data:\n\n - The Event Signature (also known as a Json Web Token (JWT). This is sent in the header)\n - The secret that is used to sign the JWT\n - The body of the webhook (as string).\n\nYou can pass this data to the `EventBuilder` service of the webhook:\n\n    use Payvision\\SDK\\Application\\Reflection\\JsonToObject;\n    use Payvision\\SDK\\Application\\Webhook\\Service\\EventBuilder;\n    use Payvision\\SDK\\Domain\\Webhook\\Service\\Validator;\n    \n    $eventBuilderService = new EventBuilder(\n        new Validator(),\n        new JsonToObject()\n    );\n    \n    $event = $eventBuilderService-\u003egenerateEvent(\n        'event signature',\n        'secret',\n        'json body'\n    );\n    \nSince the payload of the webhook event can be a variety of objects, the\n`Event::getPayload()` cannot be type-hinted. So you might want to do some\nextra checks on this:\n\n    $payload = $event-\u003egetPayload();\n    if ($payload instanceof \\Payvision\\SDK\\Domain\\Payments\\ValueObject\\Response\\Request) {\n        ...\n    } \n\nIf you don't want this (because it might miss auto-completion in your IDE because of this), you\ncan also use `EventBuilder::generateDecoratedEvent()` to get a `EventDecorator` \nthat provides extra functionality so you don't have to guess what the \npayload is:\n\n    $decoratedEvent = $eventBuilderService-\u003egenerateDecoratedEvent(\n        'event signature',\n        'secret',\n        'json body'\n    );\n\n    if ($decoratedEvent-\u003egetPayloadType() === \\Payvision\\SDK\\Domain\\Webhook\\Service\\EventDecorator::TYPE_PAYMENT) {\n        $payload = $decoratedEvent-\u003egetPaymentResponse();\n    }\n\nThe decorator also has some additional checks to make sure that the payload is known.\n\n## Developer information\n\nIf you want to analyze or improve this SDK, it's good to read the following\ninformation, targeted at developers:\n\n### Architecture\n\nThe SDK is setup in a Domain Driven way. At the core are Value Objects,\nwhich are the stateless, immutable building blocks that are used in the API. \nValue Objects can have other value objects as child-properties.\n\nTop-level Value Objects (like a Payment Request) are converted to API \nrequest objects, which are send to the API, which in turn returns a \nresponse object. Logic goes from bottom to top, dependencies go from top \nto bottom:\n\n    +-------------------+\n    |   Value Object    |           Example: Transaction, Bank, Card, etc.\n    |                   |           These can be built manually, or by using the (composite) builders\n    +-------------------+\n              ↓\n       Request Builder              Builds request out of aggregate using reflection.\n              ↓  \n    +-------------------+\n    |      Request      |           \n    +-------------------+\n              ↓\n          API Client                Does the request to the external API\n              ↓\n       Response Builder             Generates a response object out of the API response data using reflection.\n              ↓  \n    +-------------------+\n    |      Response     |           Example: PaymentResponse\n    +-------------------+\n\n### Troubleshooting\n\nSee Troubleshooting.md\n\n### Contributing\n\nIf you have an issue or a feature request, feel free to create an issue.\nIf you want to contribute to this code, you can send a pull request.\n\n## License\n\nSee LICENSE.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpayvision-development%2Fpayvision-sdk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpayvision-development%2Fpayvision-sdk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpayvision-development%2Fpayvision-sdk-php/lists"}