{"id":21446915,"url":"https://github.com/eftybv/efty-pay-php-quickstart","last_synced_at":"2026-05-17T15:38:18.395Z","repository":{"id":263695113,"uuid":"883193081","full_name":"eftybv/efty-pay-php-quickstart","owner":"eftybv","description":"The Efty Pay Quickstart guides \u0026 examples for using the Efty Pay PHP SDK: https://github.com/eftybv/efty-pay-php-sdk","archived":false,"fork":false,"pushed_at":"2025-01-14T10:37:04.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T01:42:56.835Z","etag":null,"topics":["domain-investment","efty","eftypay","examples","grpc","php","quickstart"],"latest_commit_sha":null,"homepage":"https://efty.com/partnership-program/","language":null,"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/eftybv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-04T14:36:29.000Z","updated_at":"2025-01-14T10:37:07.000Z","dependencies_parsed_at":"2025-01-23T11:39:42.234Z","dependency_job_id":null,"html_url":"https://github.com/eftybv/efty-pay-php-quickstart","commit_stats":null,"previous_names":["eftybv/efty-pay-php-quickstart"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eftybv/efty-pay-php-quickstart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eftybv%2Fefty-pay-php-quickstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eftybv%2Fefty-pay-php-quickstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eftybv%2Fefty-pay-php-quickstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eftybv%2Fefty-pay-php-quickstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eftybv","download_url":"https://codeload.github.com/eftybv/efty-pay-php-quickstart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eftybv%2Fefty-pay-php-quickstart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278734407,"owners_count":26036404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["domain-investment","efty","eftypay","examples","grpc","php","quickstart"],"created_at":"2024-11-23T03:08:17.806Z","updated_at":"2025-10-07T06:50:45.043Z","avatar_url":"https://github.com/eftybv.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# efty-pay-php-quickstart\nThe Efty Pay Quickstart guides \u0026amp; examples for using the Efty Pay PHP SDK.\n\n## Table of Contents\n\n- [Efty Pay PHP Quickstart](#efty-pay-php-quickstart)\n- [Requirements](#requirements)\n- [Required Setup](#required-setup)\n  - [Initial Setup \u0026 Token Creation](#initial-setup--token-creation)\n  - [Token Creation](#token-creation)\n  - [Set Your API Credentials in Environment Variables](#set-your-api-credentials-in-environment-variables)\n  - [Important Notes](#important-notes)\n- [Create \u0026 Onboard the Seller](#create--onboard-the-seller)\n  - [Onboard a Seller](#onboard-a-seller)\n  - [Full Examples](#full-examples)\n- [Examples](#examples)\n  - [Generate Magic Link](#generate-magic-link)\n  - [Create Transaction (with Known Seller \u0026 Buyer)](#create-transaction-with-known-seller--buyer)\n  - [Get a user](#get-a-user)\n  - [List transactions](#list-transactions)\n- [Troubleshooting](#troubleshooting-support)\n- [License](#license)\n\n## Requirements\n- PHP 7.0 or higher\n- PECL\n- Composer\n- Efty Pay API access credentials; please fill out the [access request form](https://forms.gle/fk85K45eThgepi1Q8) to obtain early access.\n\n## Other resources\n- [Efty Pay PHP SDK](https://github.com/eftybv/efty-pay-php-sdk)\n- [Efty Pay API Resource Documentation](https://docs.eftypay.com)\n\n## Required Setup\n\n### Initial setup \u0026 token creation\nMake sure gRPC is enabled for your local PHP setup. You can follow the [gRPC instructions in our Efty Pay PHP SDK repository](https://github.com/eftybv/efty-pay-php-sdk?tab=readme-ov-file#grpc) to enable this.\n\nNext, checkout this repository, and install all dependencies by running the following in the repository root.\n```\ncomposer install\n```\n\n#### Token creation\nIn order to authenticate with Efty Pay, a JWT token needs to be passed into the authorization header when making SDK request. The sample code for this can be found in [examples/helpers.php](examples/helpers.php)\n\nThe code relies on the [firebase/php-jwt](https://github.com/firebase/php-jwt) package to do the JWT token generation in PHP. Please make sure to include this library into your `composer.json` if you want to use the [examples/helpers.php](examples/helpers.php) code:\n```\n\"require\": {\n  \"eftybv/efty-pay-php-sdk\": \"v1.0.5\",\n  \"firebase/php-jwt\": \"dev-main\"\n}\n```\n\n#### Set your API credentials in your environment variables\nYou can run all the individual samples in the [examples](examples) folder, by simply adding your API credentials to your environment:\n\n```\nexport EFTY_PAY_API_KEY={{YOUR_API_KEY}}\nexport EFTY_PAY_API_SECRET={{YOUR_API_SECRET}}\nexport EFTY_PAY_INTEGRATOR_ID={{YOUR_INTEGRATOR_ID}}\nexport EFTY_PAY_API_URL=api.eftypay.com:443\n```\n\nNow cd into the `examples` folder and execute the desired scripts:\n```\ncd examples\nphp create-legal-seller-user-and-intiate-onboarding-with-mangopay.php\nphp create-transaction-new-seller-and-buyer.php\n...\n```\n\n#### Important notes\n - __It's strongly recommended that you store your API credentials server side only, and if possible encrypted. Never expose or store these credentials in your code repository or front-end code.__\n - __If you think your API credentials have been leaked or compromised, please contact us immediately to invalidate your credentials.__\n\n### Create \u0026 onboard the seller\nIn order for Efty Pay to process payments for a seller, and for a seller to receive payouts through Efty Pay, the seller needs to onboard with Efty Pay and go through our KYC process. \nThis whole process is managed through the Efty Pay web interface, but does need to be initiated by the integrator by providing Efty Pay with basic data for the seller:\n\n  - Legal status: personal or company seller.\n  - Name \u0026 address details.\n\nOnce you have completed this step, the seller will receive an email with a link to complete their onboarding.\n\nIf you want to redirect the seller to the onboarding wizard from your application, you can generate a magic link for them to redirect them to.\n\nThe magic link implements the Efty Pay OTP (One Time Password) process for secure access by the seller.\n\n#### Onboard a seller \nThe below sample onboards a seller as legal user (company).\n```php\n\u003c?php\ninclude_once(\"../vendor/autoload.php\");\ninclude_once(\"helpers.php\");\n\nuse Google\\Protobuf\\Timestamp;\n\ntry {\n    // Get the API URL.\n    $apiUrl = getenv(\"EFTY_PAY_API_URL\");\n\n    // Random string to be used in the username \u0026 email.\n    $randomString = generateRandomString(5);\n\n    // Set the options to pass to the connection clients (SSL \u0026 admin / integrator token in the authorization header).\n    $opts = [\n        \"credentials\" =\u003e \\Grpc\\ChannelCredentials::createSsl(),\n        \"update_metadata\" =\u003e function ($metaData) {\n            $token = generateToken();\n            $metaData['authorization'] = [$token];\n            return $metaData;\n        },\n    ];\n\n    // Define the clients for the users \u0026 payments API.\n    $usersClient = new \\Eftypay\\Users\\UsersClient($apiUrl, $opts);\n    $paymentsClient = new \\Eftypay\\Payments\\PaymentsClient($apiUrl, $opts);\n\n    // Define the seller with nested objects.\n    $seller = (new \\Eftypay\\Users\\User())\n        -\u003esetFirstName(\"Patrick\")\n        -\u003esetLastName(\"Kosterman\")\n        -\u003esetUsername(\"patrick-kosterman-seller-\" . $randomString)\n        -\u003esetEmail(\"patrick-kosterman-seller-\" . $randomString. \"@efty.com\")\n        -\u003esetPassword(\"wasdfp-0wsdfe-mafdfrw\")\n        -\u003esetCompanyRegistrationNumber(\"87654321\")\n        -\u003esetCompanyName(\"Efty Pay B.V.\")\n        -\u003esetCompanyAddress(\n            (new \\Eftypay\\Common\\Address())\n                -\u003esetAddressLine1(\"Zuiderpark 17\")\n                -\u003esetPostalCode(\"9724 AG\")\n                -\u003esetCity(\"Groningen\")\n                -\u003esetCountry(\\Eftypay\\Common\\CountryCode::NL)\n        )\n        -\u003esetVatSettings(\n            (new \\Eftypay\\Common\\VatSettings())-\u003esetHasVat(true)\n        )\n        -\u003esetUserType(\\Eftypay\\Users\\UserType::BUYER_OR_SELLER)\n        -\u003esetStatus(\\Eftypay\\Users\\UserStatus::ACTIVE)\n        -\u003esetPhoneNumber(\"+34615504467\")\n        -\u003esetPaymentDetails(\n            (new \\Eftypay\\Payments\\PaymentDetails())-\u003esetMangopayDetails(\n                (new \\Eftypay\\Payments\\Mangopay\\MangopayDetails())\n                    -\u003esetOnboardAsSellerWithMangopay(true)\n                    -\u003esetUserCategory(\\Eftypay\\Payments\\Mangopay\\UserCategory::OWNER)\n            )\n        );\n\n    // Create the user request.\n    $userRequest = (new \\Eftypay\\Users\\UserRequest())-\u003esetUser($seller);\n\n    // Create the user.\n    list($userResponse, $status) = $usersClient-\u003eCreateUser($userRequest)-\u003ewait();\n    if ($status-\u003ecode !== 0) {\n        // If we get an error code back, then log the error.\n        throw new Exception(sprintf(\n            'Error creating the user. Status Code: %s, Details: %s.',\n            $status-\u003ecode,\n            $status-\u003edetails\n        ));\n    }\n\n    // No error, print the new user ID.\n    echo \"New seller user created: \" . $userResponse-\u003egetId() . \"\\r\\n\";\n\n    $dateOfBirth = new \\DateTime('1982-03-21');\n    $timestamp = new Timestamp();\n    $protobufTimestamp = $timestamp-\u003efromDateTime($dateOfBirth);\n\n    // Create the onboarding object. In this case we want to onboard the seller as a legal user, as it's a company.\n    $mangopayOnboardingRequest = (new \\Eftypay\\Payments\\Mangopay\\MangopayOnboarding())\n        -\u003esetSellerUserId(\n            (new \\Eftypay\\Common\\Id())\n                -\u003esetId($userResponse-\u003egetId()) // Assuming $seller has an ID set.\n        )\n        -\u003esetLegalUser(\n            (new \\Eftypay\\Payments\\Mangopay\\LegalUser())\n                -\u003esetRegisteredName($userResponse-\u003egetCompanyName())\n                -\u003esetCompanyNumber($userResponse-\u003egetCompanyRegistrationNumber())\n                -\u003esetEmail($userResponse-\u003egetEmail())\n                -\u003esetRegisteredAddress(\n                    (new \\Eftypay\\Payments\\Mangopay\\Address())\n                        -\u003esetAddressLine1($userResponse-\u003egetCompanyAddress()-\u003egetAddressLine1())\n                        -\u003esetAddressLine2($userResponse-\u003egetCompanyAddress()-\u003egetAddressLine2())\n                        -\u003esetCity($userResponse-\u003egetCompanyAddress()-\u003egetCity())\n                        -\u003esetRegionOrCounty($userResponse-\u003egetCompanyAddress()-\u003egetStateOrCounty())\n                        -\u003esetPostalCode($userResponse-\u003egetCompanyAddress()-\u003egetPostalCode())\n                        -\u003esetCountry($userResponse-\u003egetCompanyAddress()-\u003egetCountry())\n                )\n                -\u003esetLegalRepresentative(\n                    (new \\Eftypay\\Payments\\Mangopay\\Person())\n                        -\u003esetFirstName($userResponse-\u003egetFirstName())\n                        -\u003esetLastName($userResponse-\u003egetLastName())\n                        -\u003esetEmail($userResponse-\u003egetEmail())\n                        -\u003esetDateOfBirth($protobufTimestamp)\n                        -\u003esetNationality(\\Eftypay\\Common\\CountryCode::NL)\n                        -\u003esetCountryOfResidence(\\Eftypay\\Common\\CountryCode::NL)\n                )\n                -\u003esetLegalUserType(\\Eftypay\\Payments\\Mangopay\\LegalUserType::BUSINESS)\n                -\u003esetVatNumber(\"abc123\")\n        )\n        -\u003esetOnboardingType(\\Eftypay\\Payments\\Mangopay\\OnboardingType::LEGAL_USER);\n\n        // Onboard the user; the user will receive an email with a link to complete their onboarding in the Efty Pay environment.\n        list($onboardingResponse, $status) = $paymentsClient-\u003eCreateSellerOnboardingForMangopay($mangopayOnboardingRequest)-\u003ewait();\n        if ($status-\u003ecode !== 0) {\n            // If we get an error code back, then log the error.\n            throw new Exception(sprintf(\n                'Error onboarding the user. Status Code: %s, Details: %s.',\n                $status-\u003ecode,\n                $status-\u003edetails\n            ));\n        }\n\n        // No error, print the new user ID.\n        echo \"New seller onboarding successfully initiated for user: \" . $onboardingResponse-\u003egetSellerUserId()-\u003egetId() . \"\\r\\n\";\n} catch (Exception $e) {\n    echo $e;\n}\n```\n\nFull examples:\n- Onboard natural-person seller (individual): [examples/create-individual-seller-user-and-intiate-onboarding-with-mangopay](./examples/create-individual-seller-user-and-intiate-onboarding-with-mangopay.php).\n- Onboard legal-user seller (company): [examples/create-legal-seller-user-and-intiate-onboarding-with-mangopay.php](./examples/create-legal-seller-user-and-intiate-onboarding-with-mangopay.php).\n\n## Other examples\n\n### Generate magic link \nThe `GenerateMagicLink` method can be used to generate a magic link for the user to their Efty Pay environment. Here they can see their onboarding \u0026 transaction information.\n\nThe magic links use the Efty Pay OTP process \u0026 technology for secure access.\n\n```php\n\u003c?php\ninclude_once(\"../vendor/autoload.php\");\ninclude_once(\"helpers.php\");\n\ntry {\n    // Get the API URL.\n    $apiUrl = getenv(\"EFTY_PAY_API_URL\");\n\n    // Set sellerId to the transaction ID you got from one of the create transaction samples.\n    $sellerId = \"7fsVVlCswVgFNG7miKaOjZ\";\n\n    // Set the options to pass to the connection clients (SSL \u0026 admin / integrator token in the authorization header).\n    $opts = [\n        \"credentials\" =\u003e \\Grpc\\ChannelCredentials::createSsl(),\n        \"update_metadata\" =\u003e function($metaData){\n           $token = generateToken();\n           $metaData['authorization'] = [$token];\n           return $metaData;\n        },\n    ];\n\n    $sellerId = (new \\Eftypay\\Common\\Id())\n        -\u003esetId($sellerId);\n\n    // Define the client for the payments API, and pass in the options.\n    $client = new \\Eftypay\\Payments\\PaymentsClient($apiUrl, $opts);\n    list($response, $status) = $client-\u003eGetGenericMagicLink($sellerId)-\u003ewait();\n    if ($status-\u003ecode !== 0) {\n        // If we get an error code back, then log the error.\n        throw new Exception(sprintf('Error getting the magic link. Status Code: %s, Details: %s.', $status-\u003ecode, $status-\u003edetails));\n    }\n\n    echo \"Magic link: \" . $response-\u003egetValue() . \"\\r\\n\\r\\n\";\n} catch (Exception $e) {\n    echo $e;\n}\n```\n\nFull examples:\n- Generate generic magic link: [examples/generate-generic-magic-link.php](./examples/generate-generic-magic-link.php).\n- Generate magic link for specific transaction: [examples/generate-transaction-magic-link.php](./examples/generate-transaction-magic-link.php).\n\n### Create transaction (with known seller \u0026 buyer)\nThis is the most straightforward and easy way to create a transaction (including the buyer user).\n\nNotes: \n- When creating a transaction, Efty Pay will check if the user already exists by email and/or username; these values are unique within the integrator data-space in Efty Pay. \n- If a user already exists, creating a transaction will throw an error, instead you should pass in the user ID of the existing user. \n- To get the user details (including the ID) for an email or username, you can use the [Get User method](examples/get-user.php).\n\n```php\n\u003c?php\ninclude_once(\"../vendor/autoload.php\");\ninclude_once(\"helpers.php\");\n\ntry {\n    // Get the API URL.\n    $apiUrl = getenv(\"EFTY_PAY_API_URL\");\n\n    // Random string to be used in the username \u0026 email.\n    $randomString = generateRandomString(5);\n\n    // Set sellerUserId to the user ID you got from one of the create user samples.\n    $sellerUserId = \"7fsVVlCswVgFNG7miKaOjZ\";\n\n    // Set the options to pass to the connection clients (SSL \u0026 admin / integrator token in the authorization header).\n    $opts = [\n        \"credentials\" =\u003e \\Grpc\\ChannelCredentials::createSsl(),\n        \"update_metadata\" =\u003e function($metaData){\n           $token = generateToken();\n           $metaData['authorization'] = [$token];\n           return $metaData;\n        },\n    ];\n\n    // Define the client for the users API, and pass in the options.\n    $client = new \\Eftypay\\Transactions\\TransactionsClient($apiUrl, $opts);\n\n    // Define the transaction object.\n    $transaction = (new \\Eftypay\\Transactions\\Transaction())\n            -\u003esetSeller((new \\Eftypay\\Users\\User())-\u003esetId($sellerUserId))\n            -\u003esetBuyer(\n                (new \\Eftypay\\Users\\User())\n                    -\u003esetFirstName(\"Patrick\")\n                    -\u003esetLastName(\"Kosterman\")\n                    -\u003esetUsername(\"patrick-kosterman-buyer-\" . $randomString)\n                    -\u003esetEmail(\"patrick-kosterman-buyer-\" . $randomString . \"@efty.com\")\n                    -\u003esetPassword(\"wasdfp-0wsdfe-mafdfrw\")\n                    -\u003esetCompanyRegistrationNumber(\"87654321\")\n                    -\u003esetCompanyName(\"Efty Pay B.V.\")\n                    -\u003esetCompanyAddress(\n                        (new \\Eftypay\\Common\\Address())\n                            -\u003esetAddressLine1(\"Zuiderpark 17\")\n                            -\u003esetPostalCode(\"9724 AG\")\n                            -\u003esetCity(\"Groningen\")\n                            -\u003esetCountry(\\Eftypay\\Common\\CountryCode::NL)\n                    )\n                    -\u003esetVatSettings((new \\Eftypay\\Common\\VatSettings())-\u003esetHasVat(true))\n                    -\u003esetUserType(\\Eftypay\\Users\\UserType::BUYER_OR_SELLER)\n                    -\u003esetStatus(\\Eftypay\\Users\\UserStatus::ACTIVE)\n                    -\u003esetPhoneNumber(\"+34615504467\")\n                    -\u003esetPaymentDetails(\n                        (new \\Eftypay\\Payments\\PaymentDetails())\n                            -\u003esetMangopayDetails(\n                                (new \\Eftypay\\Payments\\Mangopay\\MangopayDetails())\n                                    -\u003esetOnboardAsSellerWithMangopay(false)\n                                    -\u003esetUserCategory(\\Eftypay\\Payments\\Mangopay\\UserCategory::PAYER)\n                            )\n                    )\n            )\n            -\u003esetAssetType(\\Eftypay\\Transactions\\AssetType::DOMAIN_NAME)\n            -\u003esetDigitalAsset(\n                (new \\Eftypay\\Transactions\\DigitalAsset())\n                    -\u003esetDomain((new \\Eftypay\\Domains\\Domain())-\u003esetDomainName(\"efty\" . $randomString . \".com\"))\n            )\n            -\u003esetUtmParameters(\n                (new \\Eftypay\\Transactions\\UtmParameters())\n                    -\u003esetUtmSource(\"utm-source\")\n                    -\u003esetUtmCampaign(\"utm-campaign\")\n                    -\u003esetUtmTerm(\"utm-term\")\n                    -\u003esetUtmContent(\"utm-content\")\n                    -\u003esetUtmMedium(\"utm-medium\")\n            )\n            -\u003esetCurrency(\\Eftypay\\Common\\Currency::USD)\n            -\u003esetAssetAmountExcVat(100000); // Asset amount in cents excluding VAT. Efty Pay automatically calculates the VAT amounts based on the seller \u0026 buyer countries.\n\n    // If the transaction is initiated by the Seller (for example, through an admin interface), set this flag to true, in this case the buyer will receive an email right away that a transaction was created for them.utmParameters\n    // If the transaction is initiated by a Buy-It-Now type of button, then omit this.\n    $transaction-\u003esetInitiatedBy(\\Eftypay\\Transactions\\Activity\\TransactionParty::SELLER);\n\n    // Create the transaction.\n    $transactionRequest = new \\Eftypay\\Transactions\\TransactionRequest();\n    $transactionRequest-\u003esetTransaction($transaction);\n\n    list($newTransaction, $status) = $client-\u003eCreateTransaction($transactionRequest)-\u003ewait();\n    if ($status-\u003ecode !== 0) {\n        // If we get an error code back, then log the error.\n        throw new Exception(sprintf('Error creating the transaction. Status Code: %s, Details: %s.', $status-\u003ecode, $status-\u003edetails));\n    }\n\n    // No error, print the new transaction ID \u0026 checkout URL.\n    echo \"New transaction created: \" . $newTransaction-\u003egetId() . \"\\r\\n\";\n    echo \"Transaction checkout URL (forward the buyer to this): \" . $newTransaction-\u003egetCheckoutDetails()-\u003egetCheckoutUrl() . \"\\r\\n\";\n} catch (Exception $e) {\n    echo $e;\n}\n```\n\nFull examples:\n- Create transaction (with known buyer): [examples/create-transaction-known-buyer.php](./examples/create-transaction-known-buyer.php).\n- Create transaction (with no buyer): [examples/create-transaction-no-buyer.php](./examples/create-transaction-no-buyer.php).\n\n### Get a user\nYou can get a user by ID, email, or username. Below sample shows getting the user by ID and email.\n\n```php\n\u003c?php\ninclude_once(\"../vendor/autoload.php\");\ninclude_once(\"helpers.php\");\n\ntry {\n    // Get the API URL.\n    $apiUrl = getenv(\"EFTY_PAY_API_URL\");\n\n    // Set userId to the user ID you got from one of the create user samples.\n    $userId = \"7fsVVlCswVgFNG7miKaOjZ\";\n\n    // Set the options to pass to the connection clients (SSL \u0026 admin / integrator token in the authorization header).\n    $opts = [\n        \"credentials\" =\u003e \\Grpc\\ChannelCredentials::createSsl(),\n        \"update_metadata\" =\u003e function($metaData){\n           $token = generateToken();\n           $metaData['authorization'] = [$token];\n           return $metaData;\n        },\n    ];\n\n    // Define the client for the users API, and pass in the options.\n    $usersClient = new \\Eftypay\\Users\\UsersClient($apiUrl, $opts);\n\n    // Define the user ID.\n    $userIdRequest = (new \\Eftypay\\Common\\Id())\n        -\u003esetId($userId);\n\n    // Get the user by ID.\n    list($user, $status) = $usersClient-\u003eGetUserById($userIdRequest)-\u003ewait();\n    if ($status-\u003ecode !== 0) {\n        // If we get an error code back, then log the error.\n        throw new Exception(sprintf('Error getting the user. Status Code: %s, Details: %s.', $status-\u003ecode, $status-\u003edetails));\n    }\n\n    // No error, print the user details.\n    echo \"User details: \\r\\n\";\n    echo \"Id: \" . $user-\u003egetId() . \"\\r\\n\";\n    echo \"Username: \" . $user-\u003egetUsername() . \"\\r\\n\";\n    echo \"Email: \" . $user-\u003egetEmail() . \"\\r\\n\";\n\n    // Get the user by email address.\n    $userEmailRequest = (new \\Eftypay\\Common\\GetObjectRequest())\n        -\u003esetFieldValue($user-\u003egetEmail());\n\n    // Get the user by email.\n    list($user, $status) = $usersClient-\u003eGetUserByEmail($userEmailRequest)-\u003ewait();\n    if ($status-\u003ecode !== 0) {\n        // If we get an error code back, then log the error.\n        throw new Exception(sprintf('Error getting the user. Status Code: %s, Details: %s.', $status-\u003ecode, $status-\u003edetails));\n    }\n\n    // No error, print the user details.\n    echo \"User details: \\r\\n\";\n    echo \"Id: \" . $user-\u003egetId() . \"\\r\\n\";\n    echo \"Username: \" . $user-\u003egetUsername() . \"\\r\\n\";\n    echo \"Email: \" . $user-\u003egetEmail();\n} catch (Exception $e) {\n    echo $e;\n}\n```\n\nFull examples:\n- Get user: [examples/get-user.php](./examples/get-user.php).\n\n### List transactions\nYou can list all transactions in your account, or you can list transactions with filter criteria. The below sample lists all transactions for a seller.\n\n```php\n\u003c?php\ninclude_once(\"../vendor/autoload.php\");\ninclude_once(\"helpers.php\");\n\ntry {\n    // Get the API URL.\n    $apiUrl = getenv(\"EFTY_PAY_API_URL\");\n\n    // Set userId to the user ID you got from one of the create user samples.\n    $userId = \"7fsVVlCswVgFNG7miKaOjZ\";\n\n    // Set the options to pass to the connection clients (SSL \u0026 admin / integrator token in the authorization header).\n    $opts = [\n        \"credentials\" =\u003e \\Grpc\\ChannelCredentials::createSsl(),\n        \"update_metadata\" =\u003e function($metaData){\n           $token = generateToken();\n           $metaData['authorization'] = [$token];\n           return $metaData;\n        },\n    ];\n\n    // Define the client for the users API, and pass in the options.\n    $usersClient = new \\Eftypay\\Users\\UsersClient($apiUrl, $opts);\n\n    // Define the user ID.\n    $userIdRequest = (new \\Eftypay\\Common\\Id())\n        -\u003esetId($userId);\n\n    // Get the user by ID.\n    list($user, $status) = $usersClient-\u003eGetUserById($userIdRequest)-\u003ewait();\n    if ($status-\u003ecode !== 0) {\n        // If we get an error code back, then log the error.\n        throw new Exception(sprintf('Error getting the user. Status Code: %s, Details: %s.', $status-\u003ecode, $status-\u003edetails));\n    }\n\n    // No error, print the user details.\n    echo \"User details: \\r\\n\";\n    echo \"Id: \" . $user-\u003egetId() . \"\\r\\n\";\n    echo \"Username: \" . $user-\u003egetUsername() . \"\\r\\n\";\n    echo \"Email: \" . $user-\u003egetEmail() . \"\\r\\n\";\n\n    // Get the user by email address.\n    $userEmailRequest = (new \\Eftypay\\Common\\GetObjectRequest())\n        -\u003esetFieldValue($user-\u003egetEmail());\n\n    // Get the user by email.\n    list($user, $status) = $usersClient-\u003eGetUserByEmail($userEmailRequest)-\u003ewait();\n    if ($status-\u003ecode !== 0) {\n        // If we get an error code back, then log the error.\n        throw new Exception(sprintf('Error getting the user. Status Code: %s, Details: %s.', $status-\u003ecode, $status-\u003edetails));\n    }\n\n    // No error, print the user details.\n    echo \"User details: \\r\\n\";\n    echo \"Id: \" . $user-\u003egetId() . \"\\r\\n\";\n    echo \"Username: \" . $user-\u003egetUsername() . \"\\r\\n\";\n    echo \"Email: \" . $user-\u003egetEmail();\n} catch (Exception $e) {\n    echo $e;\n}\n```\n\nFull examples:\n- List transactions for seller: [examples/list-transactions-for-seller.php](./examples/list-transactions-for-seller.php).\n- List transactions for buyer: [examples/list-transactions-for-buyer.php](./examples/list-transactions-for-buyer.php).\n\n## Troubleshooting \u0026 Support\nIf you run into any other issues, contact us at [api@efty.com](api@efty.com).\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feftybv%2Fefty-pay-php-quickstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feftybv%2Fefty-pay-php-quickstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feftybv%2Fefty-pay-php-quickstart/lists"}