ChatBot Payments (*New)

Learn how to collect payments on your chatbot with Vendy

Vendy WhatsApp Payment API Documentation

Overview

Vendy enables businesses to collect payments directly within their WhatsApp bot applications by generating payment links through a simple API call. Customers can conveniently complete their transactions by clicking a payment button presented in WhatsApp.

Sample WhatsAppBot Integration

Sample WhatsAppBot Integration


API Endpoint

URL

POST https://api.myvendy.com/public/transactions/payment-url

Headers

  • Content-Type: application/json
  • Authorization: Bearer <token>

Note: <token> refers to your public key available at https://dashboard.myvendy.com/settings?tab=apis. JWT tokens are not required for this endpoint.


Request Body

{
  "amount": 100,
  "msisdn": "2348083042156",
  "currency": "NGN",
  "channel": "whatsapp",
  "meta": {
    "narration": "Payment for services",
    "custom-field": "your-custom-field",
    "transactionId": "your-transaction-id"
  },
  "product": "transactions"
}

Optional Parameter:

  • walletId: Specify if payment should go into a particular wallet (currency must match transaction currency).

Sample cURL Request

curl --location 'https://api.myvendy.com/transactions/initiate' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
  "businessId": {{BUSINESSID}},
  "amount": 100,
  "msisdn": "2348083042156",
  "currency": "NGN",
  "channel":"whatsapp",
  "meta": {
    "narration": "Payment for services",
    "custom-field": "your-custom-field",
    "transactionId": "your-transaction-id"
  },
  "charge_customer": false,
  "product" : "transactions"
}'

Successful Response

{
  "status": true,
  "code": 200,
  "msg": "Transaction Sent",
  "data": {
    "id": 605562920,
    "businessId": 994,
    "msisdn": "2348083042156",
    "requestamount": 100,
    "amount": 100,
    "method": "whatsapp",
    "currency": "NGN",
    "refid": "4213780500635415668",
    "meta": {
      "narration": "Request from Little Saints O for NGN100.00",
      "total": 100,
      "payment_link": true,
      "payment_methods": "sterling,fcmb_online,vendy_connect,kuda_pay,payment_card,transfer_pay,sterling_wallet,paystack_apple_pay,kuda_pay,opay_connect"
    },
    "businessName": "Your Business Name",
    "payment_link": "https://checkout.myvendy.com/pyr_y29t4hlgJBSMfgXQ"
  }
}

Steps to Create WhatsApp Payment Link Button

Step 1: Generate Payment Link

Make the above API call to generate the payment link.

Step 2: Use WhatsApp API

Utilize the WhatsApp Business API or any preferred WhatsApp bot service.

Step 3: Create Interactive Message

Construct a WhatsApp message template with an interactive button. Example:

{
  "recipient_type": "individual",
  "to": "2348083042156",
  "type": "interactive",
  "interactive": {
    "type": "button",
    "body": {
      "text": "Click below to complete your payment"
    },
    "action": {
      "buttons": [
        {
          "type": "url",
          "url": "https://checkout.myvendy.com/pyr_y29t4hlgJBSMfgXQ",
          "title": "Pay Now"
        }
      ]
    }
  }
}

Step 4: Send to Customer

Send the generated WhatsApp message using your WhatsApp API provider.


Webhooks

Configure your webhook URLs at: https://dashboard.myvendy.com/settings?tab=webhooks.

This allows you to receive transaction status updates and manage transactions effectively.


For further details or support, visit your Vendy dashboard.

Possible errors;

Error codeDescription
326Business not found
Language
Credentials
Header
Click Try It! to start a request and see the response here!