ChatBot Payments

Learn how to collect payments on your chatbot with Vendy

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Overview

Vendy lets businesses collect payments inside their WhatsApp bots. Your bot calls this endpoint to create a payment link, then shows the link to the customer as a button. The customer taps it and pays on Vendy's checkout page.

Sample WhatsAppBot Integration

Sample WhatsAppBot Integration


Authentication

Use one of these:

OptionHeadersUse it when
Public keyAuthorization: Bearer <public key>Your bot code runs somewhere your SecretKey shouldn't be stored. Find the public key at Settings → APIs
API keysAccessKey and SecretKeyThe call is made from your own server. See Authentication

The public key can also be sent as a public-key header or a publicKey query parameter.


Request body

FieldTypeRequiredDescription
amountNumberYesThe amount to collect
msisdnStringOne of msisdn or emailCustomer phone number with country code
emailStringOne of msisdn or emailCustomer email
currencyStringNoISO 4217 code, for example NGN. Defaults to your business currency
productEnum (String)Notransactions, events, foods, retail, services, reservations or vendings. Defaults to transactions
walletIdIntegerNoWallet to credit. Its currency must match currency
expiryStringNoISO 8601 date-time when the link expires, at least 2 minutes in the future
charge_customerBooleanNoAdd Vendy's fee to the amount the customer pays
deviceEnum (String)NoCustomer's device: android, ios or web
metaJSON ObjectNoAny extra data to store with the transaction. It's returned in webhooks

Sample cURL Request

curl --location 'https://api.myvendy.com/public/transactions/payment-url' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $VENDY_PUBLIC_KEY" \
--data '{
  "amount": 100,
  "msisdn": "2348012345678",
  "currency": "NGN",
  "device": "ios",
  "meta": {
    "narration": "Payment for services",
    "custom-field": "your-custom-field",
    "transactionId": "your-transaction-id"
  },
  "charge_customer": false,
  "product": "transactions"
}'

Successful Response

data.payment_link is the link to send to the customer.

{
  "status": true,
  "code": 200,
  "msg": "Transaction Sent",
  "error": "Transaction Sent",
  "data": {
    "id": 605562920,
    "businessId": 994,
    "msisdn": "2348012345678",
    "requestamount": 100,
    "amount": 100,
    "method": "web",
    "currency": "NGN",
    "refid": "4213780500635415668",
    "meta": {
      "narration": "Request from Ada's Store for NGN100.00",
      "total": 100,
      "payment_link": true
    },
    "businessName": "Ada's Store",
    "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 with an interactive URL button. Follow Meta's guide to interactive CTA URL messages.

Step 4: Send to Customer

Send the message with your WhatsApp API provider. For example, with the WhatsApp Cloud API:

curl 'https://graph.facebook.com/v23.0/<PHONE_NUMBER_ID>/messages' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $WHATSAPP_ACCESS_TOKEN" \
-d '
{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "+2348012345678",
  "type": "interactive",
  "interactive": {
    "type": "cta_url",
    "body": {
      "text": "Tap the button below to pay for your order."
    },
    "action": {
      "name": "cta_url",
      "parameters": {
        "display_text": "Pay Now",
        "url": "<payment_link from Vendy>"
      }
    },
    "footer": {
      "text": "Powered by Vendy"
    }
  }
}'

Webhooks

Configure your webhook URLs at Settings → Webhooks, or with Create Webhook. Vendy sends transaction events when the customer pays.

Possible errors

Error codeDescription
204Input is invalid. data lists each field
229 / 203Your AccessKey or SecretKey is wrong (HTTP 401)
326Business not found
337Invalid public key (HTTP 401)
338Amount above or below your transaction limit
438The customer is no longer allowed to transact
Body Params
double
required
Defaults to 10

Amount to be paid

string
Defaults to 2348012345678

Customer phone number with country code. Send msisdn or email.

string
Defaults to NGN

ISO 4217 three-letter code. Defaults to the currency for the business

string
enum
Defaults to transactions

A simple category denoting what the customer is paying for

Allowed:
string
enum

Customer's device, if known.

Allowed:
string

Customer email. Send msisdn or email.

integer

Wallet to credit. Its currency must match currency.

boolean

Add the fee to the amount the customer pays.

string

ISO 8601 date-time when the link expires, at least 2 minutes in the future.

Responses

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json