Integrating Maya Checkout for recurring creator subscriptions in a PHP app

Hi, I’m building a PHP video sharing platform (ColorFul Tube CMS) and want creators to sell monthly subscriptions. Does Maya Checkout support recurring billing or tokenized cards (Vault) for this, and what’s the recommended way to handle webhooks for renewal success or failure in PHP? Any sample flow would help. Thanks!

Maya Checkout does not support recurring billing directly. For monthly creator subscriptions, use Maya Vault to tokenize and store customer cards. Here’s the recommended flow:

  1. Tokenize the Card: During the user’s first payment, use the Pay and Save a Card flow (Document 2) to tokenize the card and link it to the customer. This generates a cardTokenId and customerId.

  2. Store Credentials: Save the cardTokenId and customerId in your database for future use.

  3. Schedule Recurring Payments: Build a PHP scheduler (e.g., using cron jobs) to trigger monthly payments. Use the Create Customer Payment endpoint with the stored cardTokenId and customerId.

  4. Handle Webhooks: Subscribe to the following webhooks for renewal status:

    • RECURRING_PAYMENT_SUCCESS: Payment succeeded. Update the subscription status to active.
    • RECURRING_PAYMENT_FAILURE: Payment failed. Notify the creator and attempt retry or notify the subscriber.

Important: 3DS authentication is only required during the initial payment. Subsequent recurring payments do not require 3DS.

Sample PHP webhook handler logic:

// webhook.php
<?php
$json = file_get_contents('php://input');
$data = json_decode($json, true);

if ($data['status'] === 'RECURRING_PAYMENT_SUCCESS') {
    // Update subscription status to active in your DB
    updateSubscriptionStatus($data['requestReferenceNumber'], 'active');
} elseif ($data['status'] === 'RECURRING_PAYMENT_FAILURE') {
    // Notify creator and mark as failed
    notifyCreatorOfFailedPayment($data['requestReferenceNumber']);
}

http_response_code(200); // Always respond with 200 OK
?>

Refer to Document 5 and Document 8 for full implementation details.

For Sandbox concerns and other technical implementation inquiries, please get in touch with us via:

  • Sandbox Health Page: Check real-time service status updates.
  • Maya Developer Hub Service Desk: File
    a ticket in Sandbox.

To Know More:

We value your input and would love to hear your insights. Please submit you feedback here.