### Install Arifpay Node.js Package Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Install the Arifpay package using npm or yarn. ```sh npm install arifpay --save # or yarn add arifpay ``` -------------------------------- ### Get Checkout Session by Session ID Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Fetches the details of a checkout session using its unique session ID. The `sandbox: true` option enables test mode. ```APIDOC ## Get Checkout Session by Session ID ### Description Fetches the details of a checkout session using its unique session ID. The `sandbox: true` option enables test mode. ### Method ```javascript arifpay.checkout.fetch('checkOutSessionID', { sandbox: true}) ``` ### Parameters #### Path Parameters - **checkOutSessionID** (string) - Required - The unique identifier of the checkout session. #### Query Parameters - **sandbox** (boolean) - Optional - Set to `true` to fetch the session in test mode. ### Response #### Success Response (200) - **id** (number) - The unique identifier of the session. - **transaction** (ArifpayTranscation) - Transaction details. - **totalAmount** (number) - The total amount of the session. - **test** (boolean) - Indicates if the session is in test mode. - **updatedAt** (string) - The timestamp when the session was last updated. - **createdAt** (string) - The timestamp when the session was created. - **uuid** (string) - The UUID of the session. - **cancelUrl** (string) - The URL to redirect to if the session is cancelled. - **nonce** (string) - A nonce value for the session. - **errorUrl** (string) - The URL to redirect to in case of an error. - **notifyUrl** (string) - The URL to send notifications to. - **successUrl** (string) - The URL to redirect to upon successful payment. - **paymentMethods** (string[]) - The payment methods available for the session. - **expireDate** (string) - The expiration date of the session. - **items** (ArifpayCheckoutItem[]) - The items included in the checkout session. - **beneficiaries** (ArifpayBeneficary[]) - The beneficiaries for the session. #### Response Example ```json { "id": 0, "transaction": {}, "totalAmount": 0, "test": true, "updatedAt": "string", "createdAt": "string", "uuid": "string", "cancelUrl": "string", "nonce": "string", "errorUrl": "string", "notifyUrl": "string", "successUrl": "string", "paymentMethods": [], "expireDate": "string", "items": [], "beneficiaries": [] } ``` ``` -------------------------------- ### Cancel Arifpay Checkout Session by ID (PHP) Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Cancel a checkout session using its ID. This example uses PHP syntax, ensure to use the correct SDK for your language. ```php $arifpay = new Arifpay('API KEY...'); // A sessionId will be returned when creating a session. $session = $arifpay->checkout->cancel('checkOutSessionID', new ArifpayOptions(true)); ``` -------------------------------- ### Initialize Arifpay with API Key (ES Modules) Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initialize the Arifpay library with your API key using ES Modules syntax. ```js import Arifpay from 'arifpay'; const arifpay = new Arifpay('API KEY...'); //for common js const Arifpay = require('arifpay').default; const arifpay = new Arifpay('API KEY...'); ``` -------------------------------- ### Initialize Arifpay with API Key (CommonJS) Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initialize the Arifpay library with your API key using CommonJS module syntax. ```js const arifpay = require('arifpay')('API KEY...'); ``` -------------------------------- ### Initialize Arifpay with API Key (TypeScript) Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initialize the Arifpay library with your API key in a TypeScript project. ```ts import Arifpay from 'arifpay'; const arifpay = new Arifpay('API KEY...'); ``` -------------------------------- ### Create Arifpay Checkout Session Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Create a checkout session using the prepared data. Pass `{ sandbox: true }` to use the test environment. ```js let session = await arifpay.checkout.create(data, { sandbox: true}); console.log(session) ``` -------------------------------- ### Create Checkout Session Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Creates a new checkout session with the provided details. The `sandbox: true` option enables test mode. ```APIDOC ## Create Checkout Session ### Description Creates a new checkout session with the provided details. The `sandbox: true` option enables test mode. ### Method ```javascript await arifpay.checkout.create(data, { sandbox: true }) ``` ### Parameters #### Request Body - **data** (ArifpayCheckoutRequest) - Required - The details for the checkout session, including beneficiaries, URLs, and items. - **options** (object) - Optional - Configuration options, such as `sandbox: true` for test mode. ### Request Example ```javascript const data = { beneficiaries: [ { accountNumber: 'account number', bank: 'bank id', amount: amount, }, ], cancelUrl: 'https://gateway.arifpay.net/', errorUrl: 'https://gateway.arifpay.net/', notifyUrl: 'https://gateway.arifpay.net/', expireDate: expired, nonce: Math.floor(Math.random() * 10000).toString(), paymentMethods: [], successUrl: 'https://gateway.arifpay.net', items: [ { name: 'Banana', price: 10.0, quantity: 1, image: "image url", description: "description..." }, ], }; let session = await arifpay.checkout.create(data, { sandbox: true}); ``` ### Response #### Success Response (200) - **sessionId** (string) - The unique identifier for the checkout session. - **paymentUrl** (string) - The URL to redirect the user to complete the payment. - **cancelUrl** (string) - The URL to redirect the user to if the payment is cancelled. - **totalAmount** (number) - The total amount of the checkout session. #### Response Example ```json { "sessionId": "string", "paymentUrl": "string", "cancelUrl": "string", "totalAmount": 0 } ``` ``` -------------------------------- ### Fetch Arifpay Checkout Session by ID Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Retrieve details of a checkout session using its ID. The `sandbox: true` option should match the environment used during session creation. ```js const arifpay = new Arifpay('API KEY...'); // A sessionId will be returned when creating a session. const session = await arifpay.checkout.fetch('checkOutSessionID', { sandbox: true}); ``` -------------------------------- ### Create Arifpay Checkout Session Request Data Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Prepare the data object for creating a checkout session, including beneficiary details, URLs, and items. Ensure 'amount' is defined before use. ```js const arifpay = new Arifpay('API KEY...'); const date = new Date(); date.setMonth(10); const expired = getExpireDateFromDate(date); const data: ArifpayCheckoutRequest = { beneficiaries: [ { accountNumber: 'account number', bank: 'bank id', amount: amount, }, ], cancelUrl: 'https://gateway.arifpay.net/', errorUrl: 'https://gateway.arifpay.net/', notifyUrl: 'https://gateway.arifpay.net/', expireDate: expired, nonce: Math.floor(Math.random() * 10000).toString(), paymentMethods: [], successUrl: 'https://gateway.arifpay.net', items: [ { name: 'Banana', price: 10.0, quantity: 1, image: "image url", description: "description..." }, ], }; ``` -------------------------------- ### DirectPay Awash Transfer and Verification Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initiate an Awash transfer and verify the OTP. Assumes `$data` and `ArifpayOptions` are defined. Requires `session.sessionId`, `phoneNumber`, `debitAccount`, and `otp`. ```js session = arifpay.checkout.create($data, new ArifpayOptions(true)); return arifpay.directPay.awash.transfer(session.sessionId, phoneNumber, debitAccount); //Verify OTP arifpay.directPay.awash.verify(session.sessionId, otp) ``` -------------------------------- ### DirectPay for telebirr Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initiates a DirectPay transaction for telebirr using the session ID obtained from creating a checkout session. The `ArifpayOptions` object with `sandbox: true` is used. ```APIDOC ## DirectPay for telebirr ### Description Initiates a DirectPay transaction for telebirr using the session ID obtained from creating a checkout session. The `ArifpayOptions` object with `sandbox: true` is used. ### Method ```javascript arifpay.directPay.telebirr.pay(session.sessionId) ``` ### Parameters #### Path Parameters - **sessionId** (string) - Required - The session ID obtained from creating a checkout session. #### Request Body - **options** (ArifpayOptions) - Required - An object containing options, such as `sandbox: true`. ### Response #### Success Response (200) - The response indicates the status of the telebirr payment initiation. ### Response Example ```json { "status": "initiated", "transactionId": "telebirr-transaction-id" } ``` ``` -------------------------------- ### DirectPay Awash Wallet Transfer and Verification Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initiate an Awash Wallet transfer and verify the OTP. Assumes `$data` and `ArifpayOptions` are defined. Requires `session.sessionId`, `phoneNumber`, and `otp`. ```js session = arifpay.checkout.create($data, new ArifpayOptions(true)); return arifpay.directPay.awashWallet.transfer(session.sessionId, phoneNumber); //Verify OTP arifpay.directPay.awashWallet.verify(session.sessionId, otp) ``` -------------------------------- ### DirectPay for awashWallet transfer Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initiates a DirectPay transfer via awashWallet using the session ID and phone number. The `ArifpayOptions` object with `sandbox: true` is used. ```APIDOC ## DirectPay for awashWallet transfer ### Description Initiates a DirectPay transfer via awashWallet using the session ID and phone number. The `ArifpayOptions` object with `sandbox: true` is used. ### Method ```javascript arifpay.directPay.awashWallet.transfer(session.sessionId, phoneNumber) ``` ### Parameters #### Path Parameters - **sessionId** (string) - Required - The session ID obtained from creating a checkout session. - **phoneNumber** (string) - Required - The phone number for the awashWallet transfer. #### Request Body - **options** (ArifpayOptions) - Required - An object containing options, such as `sandbox: true`. ### Response #### Success Response (200) - The response indicates the status of the awashWallet transfer initiation. ### Response Example ```json { "status": "initiated", "transactionId": "awash-transaction-id" } ``` ``` -------------------------------- ### DirectPay for awash verify OTP Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Verifies the One-Time Password (OTP) for an awash DirectPay transaction. Requires the session ID and the OTP. ```APIDOC ## DirectPay for awash verify OTP ### Description Verifies the One-Time Password (OTP) for an awash DirectPay transaction. Requires the session ID and the OTP. ### Method ```javascript arifpay.directPay.awash.verify(session.sessionId, otp) ``` ### Parameters #### Path Parameters - **sessionId** (string) - Required - The session ID of the awash transaction. - **otp** (string) - Required - The One-Time Password received for verification. ### Response #### Success Response (200) - The response indicates whether the OTP verification was successful. ### Response Example ```json { "status": "verified" } ``` ``` -------------------------------- ### DirectPay for awash transfer Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initiates a DirectPay transfer via awash using the session ID, phone number, and debit account. The `ArifpayOptions` object with `sandbox: true` is used. ```APIDOC ## DirectPay for awash transfer ### Description Initiates a DirectPay transfer via awash using the session ID, phone number, and debit account. The `ArifpayOptions` object with `sandbox: true` is used. ### Method ```javascript arifpay.directPay.awash.transfer(session.sessionId, phoneNumber, debitAccount) ``` ### Parameters #### Path Parameters - **sessionId** (string) - Required - The session ID obtained from creating a checkout session. - **phoneNumber** (string) - Required - The phone number for the awash transfer. - **debitAccount** (string) - Required - The debit account for the awash transfer. #### Request Body - **options** (ArifpayOptions) - Required - An object containing options, such as `sandbox: true`. ### Response #### Success Response (200) - The response indicates the status of the awash transfer initiation. ### Response Example ```json { "status": "initiated", "transactionId": "awash-transaction-id" } ``` ``` -------------------------------- ### DirectPay for awashWallet verify OTP Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Verifies the One-Time Password (OTP) for an awashWallet DirectPay transaction. Requires the session ID and the OTP. ```APIDOC ## DirectPay for awashWallet verify OTP ### Description Verifies the One-Time Password (OTP) for an awashWallet DirectPay transaction. Requires the session ID and the OTP. ### Method ```javascript arifpay.directPay.awashWallet.verify(session.sessionId, otp) ``` ### Parameters #### Path Parameters - **sessionId** (string) - Required - The session ID of the awashWallet transaction. - **otp** (string) - Required - The One-Time Password received for verification. ### Response #### Success Response (200) - The response indicates whether the OTP verification was successful. ### Response Example ```json { "status": "verified" } ``` ``` -------------------------------- ### DirectPay Telebirr Payment Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Initiate a DirectPay transaction for telebirr using the session ID obtained from creating a checkout session. Assumes `$data` and `ArifpayOptions` are defined. ```js session = arifpay.checkout.create($data, new ArifpayOptions(true)); return arifpay.directPay.telebirr.pay(session.sessionId); ``` -------------------------------- ### Arifpay Checkout Session Details Object Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md This object represents the full details of a checkout session, including transaction information, items, and beneficiaries. ```js { id: number; transaction: ArifpayTranscation; totalAmount: number; test: boolean; updatedAt: string; createdAt: string; uuid: string; cancelUrl: string; nonce: string; errorUrl: string; notifyUrl: string; successUrl: string; paymentMethods: string[]; expireDate: string; items: ArifpayCheckoutItem[]; beneficiaries: ArifpayBeneficary[]; } ``` -------------------------------- ### Arifpay Checkout Session Response Object Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md The response object returned after creating a checkout session contains sessionId, paymentUrl, cancelUrl, and totalAmount. ```js { sessionId: string; paymentUrl: string; cancelUrl: string; totalAmount: number; } ``` -------------------------------- ### Cancel Checkout Session by Session ID Source: https://github.com/arifpay-net/typescript-sdk/blob/main/README.md Cancels a checkout session using its unique session ID. Requires an `ArifpayOptions` object, potentially with `sandbox: true`. ```APIDOC ## Cancel Checkout Session by Session ID ### Description Cancels a checkout session using its unique session ID. Requires an `ArifpayOptions` object, potentially with `sandbox: true`. ### Method ```javascript $arifpay->checkout->cancel('checkOutSessionID', new ArifpayOptions(true)) ``` ### Parameters #### Path Parameters - **checkOutSessionID** (string) - Required - The unique identifier of the checkout session to cancel. #### Request Body - **options** (ArifpayOptions) - Required - An object containing options, such as `sandbox: true`. ### Response #### Success Response (200) - The `ArifpayCheckoutSession` class is returned upon successful cancellation. ### Response Example ```json { "message": "Session cancelled successfully" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.