### cURL Example for Creating an Order Source: https://payments.doc.pokpay.io/ Use this cURL command to send a POST request to create an order. It includes necessary headers like Content-Type and Authorization, along with the order details in the request body. ```curl curl --location -g '{{baseUrl}}/merchants/{{merchantId}}/sdk-orders' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {{accessToken}}' \ --data '{ "amount": 100, "currencyCode": "EUR", "autoCapture": true, "shippingCost": 0, "webhookUrl": "{{webhookUrl}}", "redirectUrl": "{{redirectUrl}}", "deeplink": "{{deeplink}}" }' ``` -------------------------------- ### Capture Payment cURL Request Source: https://payments.doc.pokpay.io/ Example cURL command to capture a payment for a specific order. Ensure to replace placeholders like {{baseUrl}}, {{merchantId}}, {{sdkOrderId}}, and {{accessToken}} with actual values. ```curl curl --location -g '{{baseUrl}}/merchants/{{merchantId}}/sdk-orders/{{sdkOrderId}}/capture' \ --header 'Authorization: {{accessToken}}' \ --data '{ "amount": 100 }' ``` -------------------------------- ### Successful Order Creation Response Source: https://payments.doc.pokpay.io/ This is a sample JSON response received upon successful order creation. It contains details about the created order, including its ID, amount, currency, and status. ```json { "statusCode": 200, "serverStatusCode": 201, "data": { "sdkOrder": { "id": "{{sdkOrderId}}", "amount": 100, "currencyCode": "ALL", "products": [ { "name": "testProduct", "quantity": 1, "price": 100 } ], "originalCurrencyCode": "ALL", "originalAmount": 110, "appliedExchangeRate": 1, "shippingCost": 10, "finalAmount": 110, "createdAt": "2022-12-28T13:40:10.625Z", "expiresAt": "2022-12-29T13:40:10.625Z", "redirectUrl": null, "failRedirectUrl": null, "_self": { "confirmUrl": "{{confirmUrl}}", "confirmDeeplink": "" }, "description": "testSdk", "isCompleted": false, "isRefunded": false, "merchantCustomReference": null, "selectedBranchId": null, "transactionId": null } }, "message": "Order created", "errors": [] } ``` -------------------------------- ### POST /auth/sdk/login Source: https://payments.doc.pokpay.io/ Logs into the POK Payments API using provided keyId and keySecret to obtain an accessToken. ```APIDOC ## POST /auth/sdk/login ### Description Logs into the POK Payments API using provided keyId and keySecret to obtain an accessToken. This token is required for authenticating subsequent API calls. ### Method POST ### Endpoint {{baseUrl}}/auth/sdk/login ### Parameters #### Request Body - **keyId** (String) - Required - Received when adding new API key. - **keySecret** (String) - Required - Received when adding new API key. ### Request Example ```json { "keyId": "{{keyId}}", "keySecret": "{{keySecret}}" } ``` ### Response #### Success Response (200) - **statusCode** (Number) - HTTP status code. - **serverStatusCode** (Number) - Server status code. - **data** (Object) - Response payload. - **accessToken** (String) - Bearer token to authenticate API calls. - **expiresIn** (Number) - Time until the access token expires. - **tokenType** (String) - Token type. - **expiresAt** (Date) - Date and time when the access token will expire. - **message** (String) - Response message. - **errors** (Array) - List of errors in the request if any. #### Response Example ```json { "statusCode": 200, "serverStatusCode": 200, "data": { "accessToken": "{{accessToken}}", "expiresIn": "3600000", "tokenType": "bearer", "expiresAt": "2022-01-20T12:59:36.400Z" }, "message": "Success", "errors": [] } ``` ``` -------------------------------- ### POST Create an Order Source: https://payments.doc.pokpay.io/ Creates a new order for a merchant. This endpoint allows specifying order details such as amount, currency, products, shipping costs, and webhook URLs. It can also handle split payments and custom references. ```APIDOC ## POST /merchants/:merchantId/sdk-orders ### Description Creates a new order for a merchant. This endpoint allows specifying order details such as amount, currency, products, shipping costs, and webhook URLs. It can also handle split payments and custom references. ### Method POST ### Endpoint {{baseUrl}}/merchants/:merchantId/sdk-orders ### Parameters #### Request Body - **amount** (Positive number) - Required if **products** is not supplied - The total amount of the order. - **currencyCode** (String) - Required - The currency code of the order. - **autoCapture** (Boolean) - Required - `true` if the order's payment should be captured automatically, `false` if the merchant wants to capture it manually. - **description** (String) - Optional - Description of the new order. - **shippingCost** (Non-negative number) - Optional - The shipping cost of the order. - **webhookUrl** (String) - Optional - Webhook URL. - **redirectUrl** (String) - Optional - URL to redirect after order is confirmed. - **failRedirectUrl** (String) - Optional - URL to redirect if order payment fails. - **deeplink** (String) - Optional - Deeplink URL. - **products** (Array of products) - Required if **`amount`**is not supplied - The structure of a product is given below. - **splitWith** (Object) - Optional - Parameters needed when the merchant is splitting the order's payment amount with another merchant. - **splitWith.merchantId** (String UUIDv4) - Optional - The ID of the merchant to split the order's payment with. This merchant must have an account with the order currency, otherwise the payments will fail. - **splitWith.amount** (Positive Number) - Required - The amount of the payment to split with the specified merchant. It has to be less than **amount.** - **splitWith.userPhoneNumber** (String (phone number of the format +355xxxxxxxxx)) - Required if `splitWith.merchantId` is not supplied - The phone number of the user to split the payment with. - **merchantCustomReference** (String) - Optional - Merchant-generated order reference. It is recommended that you send a unique value for each order so that you can perform meaningful searches for the order. - **selectedBranchId** (String UUIDv4) - Optional - The branch id where the order was created. - **expiresAfterMinutes** (Positive number) - Optional - Set the `expiresAt` field of the created sdk order. If the given amount of minutes passes the sdk order can no longer be paid. ### Product Structure - **name** (String) - Required - Name of the product. - **quantity** (Positive number) - Required - Quantity of the product. - **price** (Positive number) - Required - Price per product. ### Response #### Success Response (200) - **id** (String UUIDv4) - Unique identifier for the order. - **amount** (Positive number) - Total amount of the products in the order. If the `currencyCode` used to process the payment is different from `originalCurrencyCode`, this is the total converted amount. - **currencyCode** (String) - Currency code which will be used to process the payment. - **originalCurrencyCode** (String) - Currency code on which the order is requested to be created. - **originalAmount** (Positive number) - Original total amount paid in the original currency code. - **appliedExchangeRate** (Positive number) - Applied exchange rate to calculate `amount` from `originalAmount`. - **products** (Array) - Array of products that are contained in the order. - **shippingCost** (Non-negative number) - Cost for shipping the order. - **finalAmount** (Positive number) - Amount of the order including shipping cost. - **createdAt** (Date) - Date of creation of order. - **expiresAt** (Date) - Date of expiration of order. - **redirectUrl** (String) - URL to redirect to after confirming the order. - **failRedirectUrl** (String) - URL to redirect if order payment fails. - **merchant** (Object) - Information about the merchant who created the order. - **self.confirmUrl** (String) - Webpage URL to confirm the order. - **self.confirmDeeplink** (String) - Deeplink to POK app to confirm the order. - **description** (String) - Description of the order. - **isCompleted** (Boolean) - `true` if the order is completed successfully, `false` otherwise. - **isRefunded** (Boolean) - `true` if the order is refunded by the merchant, `false` otherwise. - **merchantCustomReference** (String) - Merchant-generated order reference, specified when creating the order. - **selectedBranchId** (String UUIDv4) - Branch id where the order is created. - **transactionId** (String UUIDv4) - Transaction id of the order payment. - **commissions** (Object) - **netAmount** (Positive number) - Total amount of the order and shipping without including commission. - **totalCommissionAmount** (Positive number) - Total commissions for the order. - **grossAmount** (Positive number) - Total amount to be paid including commission. ### Request Example ```json { "amount": 1000, "currencyCode": "USD", "autoCapture": true, "description": "Order for customer X", "products": [ { "name": "Product A", "quantity": 2, "price": 500 } ] } ``` ### Response Example ```json { "id": "ord_1234567890abcdef", "amount": 1000, "currencyCode": "USD", "originalCurrencyCode": "USD", "originalAmount": 1000, "appliedExchangeRate": 1, "products": [ { "name": "Product A", "quantity": 2, "price": 500 } ], "shippingCost": 0, "finalAmount": 1000, "createdAt": "2023-10-27T10:00:00Z", "expiresAt": "2023-10-27T11:00:00Z", "redirectUrl": "https://example.com/redirect", "failRedirectUrl": "https://example.com/fail", "merchant": { "self": { "confirmUrl": "https://pok.app/confirm?orderId=ord_1234567890abcdef", "confirmDeeplink": "pok://confirm?orderId=ord_1234567890abcdef" } }, "description": "Order for customer X", "isCompleted": false, "isRefunded": false, "merchantCustomReference": "REF12345", "selectedBranchId": "br_abcdef123456", "transactionId": null, "commissions": { "netAmount": 1000, "totalCommissionAmount": 10, "grossAmount": 1010 } } ``` ``` -------------------------------- ### Authenticate with Payments API using cURL Source: https://payments.doc.pokpay.io/ Use this cURL command to send your credentials and obtain an access token. Ensure the Content-Type is set to application/json. ```curl curl --location -g '{{baseUrl}}/auth/sdk/login' \ --header 'Content-Type: application/json' \ --data '{ "keyId": "{{keyId}}", "keySecret": "{{keySecret}}" }' ``` -------------------------------- ### Create Order Request Body Source: https://payments.doc.pokpay.io/ This JSON object defines the parameters for creating a new order. Ensure all required fields like amount and currencyCode are provided. Optional fields like splitWith, webhookUrl, and redirectUrl can be included for advanced configurations. ```json { "amount": 15000, "splitWith": { "merchantId": "{{splitWithMerchantId}}", "amount": 1000 }, "currencyCode": "ALL", "autoCapture": false, "shippingCost": 0, "webhookUrl": "{{webhookUrl}}", "redirectUrl": "{{redirectUrl}}", "failRedirectUrl": "{{failRedirectUrl}}", "deeplink": "{{deeplink}}", "expiresAfterMinutes": 1440 } ``` -------------------------------- ### POST /merchants/{merchantId}/sdk-orders Source: https://payments.doc.pokpay.io/ Creates a new order for payment processing. This endpoint allows clients to specify order details such as amount, currency, and redirect URLs. ```APIDOC ## POST /merchants/{merchantId}/sdk-orders ### Description Creates a new order for payment processing. This endpoint allows clients to specify order details such as amount, currency, and redirect URLs. ### Method POST ### Endpoint /merchants/{{merchantId}}/sdk-orders ### Parameters #### Path Parameters - **merchantId** (string) - Required - The ID of the merchant. #### Query Parameters None #### Request Body - **amount** (integer) - Required - The total amount of the order. - **splitWith** (object) - Optional - Details for splitting the payment with another merchant. - **merchantId** (string) - Required - The ID of the merchant to split with. - **amount** (integer) - Required - The amount to split. - **currencyCode** (string) - Required - The ISO 4217 currency code for the order (e.g., EUR, ALL). - **autoCapture** (boolean) - Optional - Whether to automatically capture the payment. - **shippingCost** (integer) - Optional - The cost of shipping. - **webhookUrl** (string) - Optional - The URL to send webhook notifications to. - **redirectUrl** (string) - Optional - The URL to redirect the client to upon successful payment. - **failRedirectUrl** (string) - Optional - The URL to redirect the client to upon failed payment. - **deeplink** (string) - Optional - A deeplink for mobile payments. - **expiresAfterMinutes** (integer) - Optional - The number of minutes after which the order expires. ### Request Example ```json { "amount": 100, "currencyCode": "EUR", "autoCapture": true, "shippingCost": 0, "webhookUrl": "{{webhookUrl}}", "redirectUrl": "{{redirectUrl}}", "deeplink": "{{deeplink}}" } ``` ### Response #### Success Response (200) - **statusCode** (integer) - The status code of the response. - **serverStatusCode** (integer) - The status code from the server. - **data** (object) - The data payload of the response. - **sdkOrder** (object) - Details of the created SDK order. - **id** (string) - The unique identifier for the SDK order. - **amount** (integer) - The total amount of the order. - **currencyCode** (string) - The currency code of the order. - **products** (array) - A list of products included in the order. - **originalCurrencyCode** (string) - The original currency code if currency conversion occurred. - **originalAmount** (integer) - The original amount if currency conversion occurred. - **appliedExchangeRate** (number) - The exchange rate applied if currency conversion occurred. - **shippingCost** (integer) - The shipping cost. - **finalAmount** (integer) - The final amount after all calculations. - **createdAt** (string) - The timestamp when the order was created. - **expiresAt** (string) - The timestamp when the order expires. - **redirectUrl** (string) - The redirect URL for the order. - **failRedirectUrl** (string) - The fail redirect URL for the order. - **_self** (object) - Self-referential links for the order. - **confirmUrl** (string) - The URL to confirm the order. - **confirmDeeplink** (string) - The deeplink to confirm the order. - **description** (string) - A description of the order. - **isCompleted** (boolean) - Indicates if the order is completed. - **isRefunded** (boolean) - Indicates if the order has been refunded. - **merchantCustomReference** (string) - Custom reference provided by the merchant. - **selectedBranchId** (string) - The ID of the selected branch. - **transactionId** (string) - The ID of the associated transaction. - **message** (string) - A message describing the result of the operation. - **errors** (array) - A list of errors, if any occurred. #### Response Example ```json { "statusCode": 200, "serverStatusCode": 201, "data": { "sdkOrder": { "id": "{{sdkOrderId}}", "amount": 100, "currencyCode": "ALL", "products": [ { "name": "testProduct", "quantity": 1, "price": 100 } ], "originalCurrencyCode": "ALL", "originalAmount": 110, "appliedExchangeRate": 1, "shippingCost": 10, "finalAmount": 110, "createdAt": "2022-12-28T13:40:10.625Z", "expiresAt": "2022-12-29T13:40:10.625Z", "redirectUrl": null, "failRedirectUrl": null, "_self": { "confirmUrl": "{{confirmUrl}}", "confirmDeeplink": "" }, "description": "testSdk", "isCompleted": false, "isRefunded": false, "merchantCustomReference": null, "selectedBranchId": null, "transactionId": null } }, "message": "Order created", "errors": [] } ``` ``` -------------------------------- ### Authentication Request Payload Source: https://payments.doc.pokpay.io/ Send your keyId and keySecret in JSON format to authenticate with the API. ```json { "keyId": "{{keyId}}", "keySecret": "{{keySecret}}" } ``` -------------------------------- ### Capture Payment Success Response Source: https://payments.doc.pokpay.io/ A successful response (200 OK) after capturing a payment. It returns the updated sdkOrder object with details of the captured payment. ```json { "statusCode": 200, "serverStatusCode": 201, "data": { "sdkOrder": { "id": "{{sdkOrderId}}", "amount": 100, "currencyCode": "ALL", "products": [ { "name": "testProduct", "quantity": 1, "price": 100 } ], "originalCurrencyCode": "ALL", "originalAmount": 110, "appliedExchangeRate": 1, "shippingCost": 10, "finalAmount": 110, "createdAt": "2022-12-28T13:40:10.625Z", "expiresAt": "2022-12-29T13:40:10.625Z", "redirectUrl": null, "failRedirectUrl": null, "_self": { "confirmUrl": "{{confirmUrl}}", "confirmDeeplink": "" }, "description": "testSdk", "isCompleted": false, "isCanceled": false, "isRefunded": false, "merchantCustomReference": null, "selectedBranchId": null, "transactionId": null } }, "message": "Order created", "errors": [] } ``` -------------------------------- ### POST /merchants/:merchantId/sdk-orders/:sdkOrderId/capture Source: https://payments.doc.pokpay.io/ Captures the payment of an order. This is used when the client confirms the order and autoCapture is false. ```APIDOC ## POST /merchants/:merchantId/sdk-orders/:sdkOrderId/capture ### Description Captures the payment of an order. When the client confirms the order and the order `autoCapture` is `false`, calling this endpoint will result on the capture of the payment. ### Method POST ### Endpoint {{baseUrl}}/merchants/:merchantId/sdk-orders/:sdkOrderId/capture ### Parameters #### Path Parameters - **merchantId** (String (uuidv4)) - Required - The ID of the merchant. - **sdkOrderId** (String) - Required - The ID of the SDK order. #### Request Body - **amount** (Positive Number) - Required - Amount to capture from the sdk order. This amount should be less than or equal to the sdk order total amount. - **splitWith** (Object) - Optional - Information regarding the splitting of the captured payment with another merchant. - **merchantId** (String (uuidv4)) - Required - ID of the merchant to split the payment with. - **amount** (Positive Number) - Required - Amount from the order payment capture to send to the merchant with whom the payment will be split. ### Request Example ```json { "amount": 1000, "splitWith": { "merchantId": "8ee5193a-7592-464d-91ba-dc2206edd133", "amount": 100 } } ``` ### Response #### Success Response (200) - **sdkOrder** (Object) - The order whose payment was captured. #### Response Example ```json { "statusCode": 200, "serverStatusCode": 201, "data": { "sdkOrder": { "id": "{{sdkOrderId}}", "amount": 100, "currencyCode": "ALL", "products": [ { "name": "testProduct", "quantity": 1, "price": 100 } ], "originalCurrencyCode": "ALL", "originalAmount": 110, "appliedExchangeRate": 1, "shippingCost": 10, "finalAmount": 110, "createdAt": "2022-12-28T13:40:10.625Z", "expiresAt": "2022-12-29T13:40:10.625Z", "redirectUrl": null, "failRedirectUrl": null, "_self": { "confirmUrl": "{{confirmUrl}}", "confirmDeeplink": "" }, "description": "testSdk", "isCompleted": false, "isCanceled": false, "isRefunded": false, "merchantCustomReference": null, "selectedBranchId": null, "transactionId": null } }, "message": "Order created", "errors": [] } ``` ``` -------------------------------- ### Successful Authentication Response Source: https://payments.doc.pokpay.io/ A successful response includes an accessToken, expiration details, and token type. The accessToken is a bearer token used for subsequent API calls. ```json { "statusCode": 200, "serverStatusCode": 200, "data": { "accessToken": "{{accessToken}}", "expiresIn": "3600000", "tokenType": "bearer", "expiresAt": "2022-01-20T12:59:36.400Z" }, "message": "Success", "errors": [] } ``` -------------------------------- ### Capture Payment Request Body Source: https://payments.doc.pokpay.io/ This JSON payload is used to capture a payment for an order. It includes the amount to capture and optional splitWith details for splitting the payment with another merchant. ```json { "amount": 1000, "splitWith": { "merchantId": "8ee5193a-7592-464d-91ba-dc2206edd133", "amount": 100 } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.