Card

Creates a BlockPay payment link that can be shared with a customer to complete a payment.

The merchant specifies the amount, currency, customer details, and payment configuration. LedgerBlock returns a unique payment reference and a hosted checkout link.

Endpoint

POST /api/v1/collection/blockpay-link

Authorization

Bearer Token

A valid Bearer Token is required.

Headers

HeaderDescriptionRequired
AuthorizationBearer token used to authenticate the requestYes
x-merchant-refUnique reference identifying the merchantYes

Request Body

FieldDescriptionRequired
user_refReference of the user associated with the collectionYes
txn_merchant_refUnique transaction reference generated by the merchantYes
amountAmount to be collectedYes
currencyCurrency of the paymentYes
full_nameFull name of the customerYes
emailCustomer's email addressYes
phoneCustomer's phone numberYes
chainBlockchain network, where applicableNo
success_messageMessage displayed after a successful paymentNo
payment_methodPayment method. For BlockPay links, use BLOCK_PAY_LINKYes
redirect_urlURL to redirect the customer after paymentYes
notification_urlURL where transaction notifications should be sentYes

Request

curl --location -g '{{base_url}}/api/v1/collection/blockpay-link' \
--header 'Authorization: Bearer <token>' \
--header 'x-merchant-ref: {{vault:x-merchant-ref}}' \
--header 'Content-Type: application/json' \
--data '{
    "user_ref": "USR_TEST_001",
    "txn_merchant_ref": "TXN_TEST_BP_001",
    "amount": 250,
    "currency": "NGN",
    "full_name": "Test Customer",
    "email": "[email protected]",
    "phone": "08000000000",
    "chain": "",
    "success_message": "Payment successful",
    "payment_method": "BLOCK_PAY_LINK",
    "redirect_url": "https://example.com/payment/success",
    "notification_url": "https://example.com/webhooks/payment"
}'

Response

{
  "status": "success",
  "message": "BlockPay link created successfully",
  "data": {
    "payment_ref": "BPAY-TEST-001",
    "pay_link": "https://blockpay.example.com/checkout?ref=BPAY-TEST-001&currency=NGN&amount=250&txn_ref=TXN_TEST_BP_001",
    "txn_merchant_ref": "TXN_TEST_BP_001",
    "amount": 250,
    "currency": "NGN",
    "redirect_url": "https://example.com/payment/success",
    "success_message": "Payment successful",
    "pay_data": null
  }
}

Note: All values in the request and response examples are dummy data for documentation purposes. Replace them with your actual values when making API requests.


Did this page help you?