# API specs for BNPL using Markets

This page describes details of API integration for Markets who want to integrate BNPL Gateway.

# Create an order

Every BNPL transaction should be associated with an order. You need to generate a new order object on your backend. You will obtain order ID, so you can check the order status afterwards.

WARNING

Please ensure you keep Order ID in your system because it is necessary when the transaction is completed.

# Sandbox
[POST] https://sandbox-api.credify.dev/v1/bnpl-consumers/orders

# Production
[POST] https://api.credify.one/v1/bnpl-consumers/orders
Request header:
- "Authorization": YOUR_TEMPORARY_TOKEN

This is a sample JSON object that is to be sent in a request body.

{
  "reference_id": "string",
  "total_amount": {
    "value": "120000",
    "currency": "VND"
  },
  "order_lines": [
    {
      "name": "Soda",
      "reference_id": "string",
      "image_url": "string",
      "product_url": "string",
      "quantity": 12,
      "unit_price": {
        "value": "10000",
        "currency": "VND"
      },
      "subtotal": {
        "value": "120000",
        "currency": "VND"
      },
      "measument_unit": "EACH"
    }
  ],
  "payment_recipient": {
    "name": "string",
    "number": "string",
    "branch": "string",
    "bank": "string"
  }
}
  • reference_id: string
    • ID that you want to use in your platform to look up the order
  • total_amount: object
    • value is a string value that represents price.
    • currency is VND / USD / JPY (currently, only VND is available)
  • order_lines: array<object>
    • name is item's name
    • reference_id is ID that you use in your platform to represent the item (optional)
    • image_url is image URL to the item (optional)
    • product_url is detail URL to the item (optional)
    • quantity is the number of items
    • unit_price is how much the item costs per unit (e.g. 1 item, 1 kg)
    • subtotal is how much the item costs
    • measurement_unit is how to measure the item
  • payment_recipient: object
    • name is a recipient's name
    • number is a recipient's bank account number
    • branch is a recipient's bank branch
    • bank is a recipient's bank name
  • Node.js
  • Java
  • .NET
const { Credify } = require("@credify/nodejs");

// You obtain these on the serviceX dashboard.
const signingPrivateKey = `-----BEGIN PRIVATE KEY-----
your private key...
-----END PRIVATE KEY-----`;
const apiKey = "YOUR_API_KEY";

const referenceId = req.body.reference_id;
const totalAmount = req.body.total_amount;
const orderLines = req.body.order_lines;
const paymentRecipient = req.body.payment_recipient;
// This is a sample. It should use `async`
const credify = await Credify.create(signingPrivateKey, apiKey, { mode: "sandbox" });
// This is a sample. It should use `async`
const data = await credify.bnpl.createOrder(
  referenceId,
  totalAmount,
  orderLines,
  paymentRecipient
);
Last Updated: 7/19/2022, 10:48:04 AM