X-Payments:Redirecting a customer to the cardholder data entering page

From X-Payments Help
Jump to: navigation, search
X-Payments API
  1. API versions supported
  2. Samples
  3. API requests
  4. API Requests from the store to X-Payments
    1. Admin area/X-Payments configuration
    2. Payment creation (Regular payment and tokenization)
    3. Payment information
    4. Actions on payments (secondary actions)
  5. Callback requests (web-hooks) from X-Payments to the store
  6. Browser-related
  7. Appendix A. Status codes.
  8. See also

A form is created that sends data to the URL https://example.com/xpayments/payment.php, where "https://example.com/xpayments/" is the X-Payments web root directory.

The form must be POST-ed via HTTPS and must contain the following fields:

  • target: should be "main";

  • action: should be "start";

  • token: uses the value from the token field received in the response to the payment initialization request);

  • allow_save_card: optional field that instructs X-Payments regarding tokenization. The allowed values for this field are:
  • "Y" - The card must be tokenized (if all the conditions in X-Payments are met: i.e., if the payment gateway allows tokenization and if tokenization is enabled in the payment configuration settings). Common use case: The very first payment in a series of subscription payments during which the card is saved for further subscription payments.

  • "O" - Allow the customer to choose whether they want to save the card or not. A special checkbox will be added to the payment form. Again, all the conditions must be met: the payment gateway must allow tokenization and tokenization must be enabled in the payment configuration settings. Common use case: A regular payment by a customer who is registered (or has an account) with the store. So the card is associated with this account.

  • "N" - Do not save the card. Common use case: payment by an anonymous customer, who is not registered or does not have an account with the store.

Example of the form

This is the sample code of the form that redirects the customer to the X-Payments page where the credit card form is displayed. The form is auto-submitted.

    <form action="https://demo.x-checkout.com/payment.php" method="post" id="payment-form">
        <input type="hidden" name="target" value="main" />
        <input type="hidden" name="action" value="start" />
        <input type="hidden" name="token" value="73787ac787fc5659199f5a98cd99ed6f" />
        <input type="hidden" name="allow_save_card" value="O" />
    <script type="text/javascript">
        var paymentform = document.getElementById('payment-form');
        window.onload = function() {