The BuildNow SDK allows seamless integration of the "Buy Now Pay Later" functionality into your web application. This documentation outlines how to use the SDK to render the "Pay Later" button and process payments using a purchase order token.
<script src="<https://cdn.buildnow.sa/sdk/v1/buildnow.js>"></script>
To initialize the SDK, create an instance of the BuildNow class by passing a valid purchase order token Purchase Order
var buildNow = new BuildNow({PURCHASE_ORDER_TOKEN});
| Parameter | Type | Required | Description |
|---|---|---|---|
token |
String | Yes | The purchase order token obtained from the API (e.g., purchase_token). |
payThe pay method is used to render the "Pay Later" button in a target HTML element.
buildNow.pay('later', {
"target": '.buildnow-bnpl-btn',
"locale": 'ar'
});
| Parameter | Type | Required | Description |
|---|---|---|---|
type |
String | Yes | The payment type. Use 'later' for Buy Now Pay Later (BNPL) functionality. |
options |
Object | Yes | Configuration options for rendering the button. |
| Option | Type | Required | Description |
|---|---|---|---|
target |
String | Yes | A CSS selector for the DOM element where the "Pay Later" button will be rendered (e.g., .buildnow-bnpl-btn). |
locale |
String | No | Configuration options for the local of the button. Default en , available options 'ar' , 'en' |