Complete guide to integrating Stripe payments, subscriptions, and marketplace functionality.
Base URL: https://api.tayaribykmg.com
Authentication: Bearer token required
Content-Type: application/json
Test Mode: Use test API keys for sandbox environment
POST /api/stripe/payment-intent{
"amount": 2000,
"currency": "usd",
"customer_id": "cus_123456789",
"metadata": {
"order_id": "order_123",
"product": "premium_subscription"
}
}{
"id": "pi_1ABC123def456",
"amount": 2000,
"currency": "usd",
"status": "requires_payment_method",
"client_secret": "pi_1ABC123def456_secret_xyz",
"created": 1609459200
}POST /api/stripe/confirm-payment{
"payment_intent_id": "pi_1ABC123def456",
"payment_method": "pm_1ABC123def456",
"return_url": "https://your-site.com/return"
}POST /api/stripe/customers{
"email": "customer@example.com",
"name": "John Doe",
"phone": "+1234567890",
"metadata": {
"user_id": "123",
"source": "website"
}
}POST /api/stripe/subscriptions{
"customer_id": "cus_123456789",
"price_id": "price_1ABC123def456",
"trial_period_days": 14,
"metadata": {
"plan": "premium",
"features": "unlimited_api_calls"
}
}POST /api/stripe/connect/accounts{
"type": "express",
"country": "US",
"email": "merchant@example.com",
"business_profile": {
"name": "Merchant Business",
"url": "https://merchant.com"
}
}POST /api/stripe/webhookspayment_intent.succeeded - Payment completed successfullypayment_intent.payment_failed - Payment failedcustomer.subscription.created - New subscription createdcustomer.subscription.updated - Subscription modifiedcustomer.subscription.deleted - Subscription cancelledinvoice.payment_succeeded - Invoice paidinvoice.payment_failed - Invoice payment failedaccount.updated - Connect account updatedGET /api/stripe/payment-methodsVisa, Mastercard, Amex
Apple Pay, Google Pay
ACH, SEPA
Klarna, Afterpay
iDEAL, Bancontact
Bitcoin (via partners)
400Bad Request - Invalid parameters or missing required fields401Unauthorized - Invalid API key402Payment Required - Card declined or insufficient funds403Forbidden - Request not allowed429Too Many Requests - Rate limit exceedednpm install @stripe/stripe-jsnpm install stripepip install stripecomposer require stripe/stripe-phpgem install stripeflutter pub add stripe_payment4242424242424242 - Visa (Success)
4000000000000002 - Visa (Declined)
4000000000009995 - Visa (Insufficient funds)
5555555555554444 - Mastercard (Success)
Use test API keys starting with sk_test_ and pk_test_