Skip to main content

Basic Request

curl -X POST https://api.yabetoo.com/v1/payment-links \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "amount",
    "name": "Invoice Payment",
    "amount": 25000,
    "currency": "XOF"
  }'

Required Parameters

ParameterTypeDescription
typestringLink type: product, amount, or subscription
namestringLink name (displayed to customer)
currencystringCurrency code (XOF, EUR, USD)

Optional Parameters

ParameterTypeDescription
descriptionstringLink description
slugstringCustom slug for the URL
amountnumberFixed amount (for amount type)
minAmountnumberMinimum amount (for variable amount)
maxAmountnumberMaximum amount (for variable amount)
itemsarrayItems to sell (for product type)
expiresAtstringExpiration date (ISO 8601)
maxRedemptionsnumberMaximum number of uses
collectBillingAddressbooleanCollect billing address
collectShippingAddressbooleanCollect shipping address
allowPromotionCodesbooleanAllow promo codes
successUrlstringRedirect URL after payment
cancelUrlstringRedirect URL if cancelled
brandingIdstringCustom branding ID
metadataobjectCustom data

Type amount - Fixed Amount

To collect a specific amount:
{
  "type": "amount",
  "name": "Invoice #1234",
  "description": "Payment for your January invoice",
  "amount": 50000,
  "currency": "XOF"
}

Item Structure

For product and subscription types, you can define items:
FieldTypeDescription
productIdstringProduct ID (prod_xxx)
priceIdstringPrice ID (price_xxx)
namestringCustom name (if no product)
descriptionstringCustom description
imageUrlstringImage URL
quantitynumberDefault quantity (default: 1)
adjustableQuantitybooleanAllow customer to modify quantity
minQuantitynumberMinimum quantity
maxQuantitynumberMaximum quantity
isOptionalbooleanOptional item (customer can remove it)
sortOrdernumberDisplay order

Advanced Options

Limit Usage

{
  "type": "amount",
  "name": "Limited Offer",
  "amount": 15000,
  "currency": "XOF",
  "maxRedemptions": 100,
  "expiresAt": "2024-12-31T23:59:59Z"
}

Collect Addresses

{
  "collectBillingAddress": true,
  "collectShippingAddress": true
}

Allow Promo Codes

{
  "allowPromotionCodes": true
}

Custom Redirect URLs

{
  "successUrl": "https://your-site.com/thank-you?link_id={PAYMENT_LINK_ID}",
  "cancelUrl": "https://your-site.com/cancelled"
}

Custom Slug

Create a memorable URL:
{
  "slug": "donate-2024"
}
The URL will be: https://checkout.yabetoo.com/p/donate-2024

Complete Example

curl -X POST https://api.yabetoo.com/v1/payment-links \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "product",
    "name": "Training Shop",
    "description": "Online courses",
    "slug": "training",
    "currency": "XOF",
    "collectBillingAddress": true,
    "allowPromotionCodes": true,
    "successUrl": "https://your-site.com/success",
    "cancelUrl": "https://your-site.com/cancel",
    "maxRedemptions": 500,
    "expiresAt": "2024-12-31T23:59:59Z",
    "items": [
      {
        "productId": "prod_js_course",
        "priceId": "price_js_course",
        "quantity": 1,
        "adjustableQuantity": false
      },
      {
        "productId": "prod_react_course",
        "priceId": "price_react_course",
        "quantity": 1,
        "isOptional": true
      }
    ],
    "metadata": {
      "campaign": "summer_2024",
      "source": "newsletter"
    }
  }'

Response

{
  "id": "plink_abc123def456ghi789jkl012",
  "object": "payment_link",
  "type": "product",
  "name": "Training Shop",
  "description": "Online courses",
  "slug": "training",
  "url": "https://checkout.yabetoo.com/p/training",
  "currency": "XOF",
  "amount": null,
  "minAmount": null,
  "maxAmount": null,
  "isActive": true,
  "expiresAt": "2024-12-31T23:59:59.000Z",
  "maxRedemptions": 500,
  "redemptionCount": 0,
  "collectBillingAddress": true,
  "collectShippingAddress": false,
  "allowPromotionCodes": true,
  "successUrl": "https://your-site.com/success",
  "cancelUrl": "https://your-site.com/cancel",
  "items": [
    {
      "id": "plitem_abc123",
      "productId": "prod_js_course",
      "priceId": "price_js_course",
      "name": "JavaScript Course",
      "description": "Master JavaScript",
      "quantity": 1,
      "adjustableQuantity": false,
      "isOptional": false,
      "sortOrder": 0
    },
    {
      "id": "plitem_def456",
      "productId": "prod_react_course",
      "priceId": "price_react_course",
      "name": "React Course",
      "description": "Build React apps",
      "quantity": 1,
      "adjustableQuantity": false,
      "isOptional": true,
      "sortOrder": 1
    }
  ],
  "metadata": {
    "campaign": "summer_2024",
    "source": "newsletter"
  },
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-15T10:30:00.000Z"
}

Response Fields

FieldDescription
idUnique link identifier
urlPublic URL to share
slugSlug used in the URL
isActiveIndicates if the link is active
redemptionCountNumber of times the link has been used
itemsList of items (for product type)

Common Operations

curl https://api.yabetoo.com/v1/payment-links/plink_abc123 \
  -H "Authorization: Bearer sk_live_..."
curl -X PATCH https://api.yabetoo.com/v1/payment-links/plink_abc123 \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "New Name",
    "isActive": false
  }'
curl -X PATCH https://api.yabetoo.com/v1/payment-links/plink_abc123 \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "isActive": false
  }'
curl -X DELETE https://api.yabetoo.com/v1/payment-links/plink_abc123 \
  -H "Authorization: Bearer sk_live_..."
curl "https://api.yabetoo.com/v1/payment-links?type=product&isActive=true" \
  -H "Authorization: Bearer sk_live_..."

Webhooks

Receive notifications when a payment is made via a link:
{
  "type": "payment_link.payment.completed",
  "data": {
    "object": {
      "paymentLinkId": "plink_abc123",
      "sessionId": "plsession_xyz789",
      "amount": 25000,
      "currency": "XOF",
      "customerEmail": "customer@example.com",
      "status": "completed"
    }
  }
}

Available Events

EventDescription
payment_link.createdLink created
payment_link.updatedLink updated
payment_link.payment.completedSuccessful payment via link
payment_link.payment.failedFailed payment

Best Practices

  • Always create links server-side
  • Never store API keys client-side
  • Use webhooks to verify payments
  • Use memorable slugs for important links
  • Add a clear description
  • Set a reasonable expiration date
  • Use metadata for tracking (campaign, source, etc.)
  • Monitor redemptionCount for limited offers
  • Deactivate links rather than deleting them

Next Steps

Share a Link

Learn how to share your links effectively

Webhooks

Configure real-time notifications