Pay
Checkout

Checkout

Accept payments with flexible, secure checkout options designed for your application needs.


Payload provides two primary pre-built checkout solutions for collecting payments from your customers. See below to learn more about the two options.

Checkout Options

Choosing the Right Solution

Both checkout solutions offer secure payment processing with PCI compliance handled by Payload. The main difference is where your customers complete the payment - on a Payload-hosted page or embedded directly in your application.

FeatureCheckout LinkCheckout Plugin
ExperienceHosted on PayloadEmbedded in your app
IntegrationSimple URL redirectJavaScript SDK
CustomizationLimitedFull control over UI
PCI ComplianceHandled by PayloadHandled by Payload
Autopay Setup
Mobile Wallets
Return to AppRequiredOptional

Quick Start

Embed the checkout form in your application

import payload
pl = payload.Session('secret_key_3bW9...', api_version='v2')
 
from flask import Flask, jsonify
 
app = Flask(__name__)
 
@app.route('/create-checkout-intent', methods=['POST'])
def create_checkout_intent():
    # Create a checkout intent token on your backend server
    intent = pl.Intent.create(
        type='checkout_plugin',
        checkout_plugin={
            'payment_template': {
                'amount': 100.00,
                'description': 'Order #12345',
                'receiver': {
                    'account_id': 'acct_receiver123'
                }
            }
        }
    )
 
    # Send the token to your frontend
    return jsonify({'token': intent.token})
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Checkout Button - Vanilla JS</title>
  <script src="https://payload.com/Payload.js"></script>
</head>
<body>
  <button id="checkout-btn" disabled>Pay Now</button>
 
  <script src="modal.js"></script>
</body>
</html>
const btn = document.getElementById('checkout-btn');
 
// Fetch token and enable button
fetch('/checkout_intent')
  .then(r => r.json())
  .then(data => {
    btn.disabled = false;
    btn.onclick = () => {
      Payload(data.token);
      new Payload.Checkout()
        .on('success', evt => {
          console.log('Payment successful!', evt.transaction_id);
          window.location.href = `/payment/success?txn=${evt.transaction_id}`;
        })
        .on('declined', evt => {
          console.error('Payment declined:', evt.transaction_id);
          alert(`Payment declined: ${evt.transaction_id}`);
        })
        .on('closed', () => {
          console.log('Customer closed checkout');
        });
    };
  })
  .catch(err => console.error('Failed to load checkout token:', err));

What happens:

  1. Create a checkout intent on your server
  2. Pass the intent token to your frontend
  3. Initialize and mount the Checkout Plugin with the token
  4. Listen for payment completion events
  5. Handle success or error cases

Related Topics