Buy SMS
API reference
Buy SMS from your site
Your server calls Taysend with the same Bearer key you use to send. The key identifies the wallet. The person at the shop never signs in to Taysend. Keep the key on the server. The browser only opens the checkout URL.
GET /v1/billing
curl https://api.taysend.com/v1/billing \
-H "Authorization: Bearer $TAYSEND_KEY"The response includes sms_left and the published packages (id, amount, sms).
Start a payment
POST /v1/billing/checkout with a package_id and the page on your site to return to after payment.
POST /v1/billing/checkout
curl -X POST https://api.taysend.com/v1/billing/checkout \
-H "Authorization: Bearer $TAYSEND_KEY" \
-H "Content-Type: application/json" \
-d '{
"package_id": "ghs-20",
"success_url": "https://yourshop.com/sms/thanks"
}'Redirect the browser to checkout_url. After payment, GET /v1/billing/checkout/:id with the same key. status succeeded means the SMS are on the wallet. sms on that response is how many were added.