PaySwitcher
  • About PaySwitcher
    • 🛒For Online Businesses
    • 🪜For Small & Medium Enterprises
    • 🏢For Enterprises
    • 🖥️For SaaS Providers
    • 🛍️For E-Commerce Businesses
    • 📦For Marketplace/Platforms
    • 🏦For Banks & Financial Institutions
  • PaySwitcher Cloud
    • ⚡Quickstart
      • 📥Migrate from Stripe
        • Web
        • Android
        • iOS
        • React Native
      • 🥗Payment Recipes
        • Use PayPal With Stripe
    • ⚙️Control Centre Account setup
    • 📦Integration guide
      • 🌐Web
        • Node And React
        • Customization
        • Error Codes
        • Node and HTML
        • Vanilla JS and REST API Integration
      • 📱Android
        • Kotlin with Node Backend
        • Customization
        • Features
      • 📱iOS
        • Swift with Node Backend
        • Customization
        • Features
      • ⏺️React Native
        • React Native with Node Backend (Beta)
        • Card Widget (Beta)
        • Customization
      • ⏺️Flutter
        • Flutter with Node Backend
        • Customization
      • Headless SDK
      • Payment Methods Management
    • 💳Payment methods setup
      • 💳Cards
      • 📱Wallets
        • Apple Pay
          • Web Domain
          • iOS Application
        • Google Pay
        • PayPal
      • 📆Pay Later
      • 🏦Banks
        • Bank Debits
        • Bank Redirects
        • Bank Transfers
      • 🪙Crypto
      • 🔑Test Credentials
    • 🔌Connectors
      • 🖲️Available Connectors
        • ACI
        • Adyen
        • Airwallex
        • Authorizedotnet
        • Bambora
        • Bank of America
        • Billwerk
        • Bluesnap
        • Braintree
        • Checkout
        • Coinbase
        • Cybersource
          • Apple Pay
          • Google Pay
        • dLocal
        • Fiserv
        • GlobalPayments
        • GoCardless
        • Klarna
        • Mollie
        • MultiSafepay
        • Nuvei
        • OpenNode
        • Paypal
        • PayU
        • Prophetpay
        • Rapyd
        • Shift4
        • Stripe
        • TrustPay
        • Volt
        • Worldline
        • Worldpay
        • Zen
      • Activate connector on PaySwitcher
      • Test a Payment with connector
    • 🪝Webhooks
  • Features
    • 🔀Payment flows
      • 🔁Saving payment methods & recurring payments
      • 💵Payouts
        • ➕Get started with payouts!
        • 🔗Process payouts using saved payment methods
        • 🛣️Route your payout transactions using Smart Router
        • ♻️Smart Retries in Payout
        • 🔗Payout links
      • 0️ 0️ 0️ Zero Amount Authorization
      • 🔓Tokenization & saved cards
      • 🔗Payment links
      • ⏭️External Authentication for 3DS
      • 💰Manual Capture
      • 🛑Fraud Blocklist
      • 🔁Subscriptions
      • 🔃PG Agnostic Recurring Payments
    • 🕹️Merchant controls
      • 🛣️Smart Router
        • Rule Based Routing
        • Volume Based Routing
        • Default Fallback Routing
      • 🛡️Fraud & risk management
      • 🔃Smart retries
      • 🎛️Analytics & operations
      • 📋3DS decision manager
        • Setup guide
      • 📋Surcharge
        • Surcharge Setup guide
      • 🔼3DS Step-up retries
      • 🚩Disputes/Chargebacks Management
      • 🤝Reconciliation
        • Getting Started with Recon
    • 🔑Account management
      • 🔢Exporting payments data
      • 🤹Multiple accounts & profiles
      • 🛂Manage your team
    • 🛍️E-commerce platform plugins
      • WooCommerce Plugin
        • Setup
        • Compatibility
        • FAQs
  • SECURITY AND COMPLIANCE
    • 🔏Overview
    • 💳PCI Compliance
    • 🔐Data Security
    • 💽GDPR compliance
    • 🕵️Identity and Access Management
  • Learn more
    • 🍡SDK Reference
      • Node
      • React
      • JS
    • 📐PaySwitcher Architecture
      • Router
      • Storage
      • A Payments Switch with virtually zero overhead
    • 🌊Payment flows
Powered by GitBook
On this page
  1. Features
  2. Payment flows

0️ 0️ 0️ Zero Amount Authorization

Best way to validate customer payment data and charge the customer later

In this section, we will understand zero-auth flow, it's usage, and webhook consumption

The zero amount authorization flow in PaySwitcher allows the merchant to validate customer payment data and charge the customer later. On customer registration, the merchant can initiate a zero-auth flow transaction with PaySwitcher to authenticate the customer payment method (card, bank account etc.) and receive authorization from the customer to use the payment method to charge them at a later point. A payment_method_id would be created and issued to the merchant. And in the future they can charge against this payment_method_id.

The following API cURLs demonstrate the usage of the zero-auth flow. The example below uses the credit card payment method. But this can be extended to bank debits and other payment methods as well.

How to use the zero amount authorization flow?

  1. Creating a 0 amount payment along with setup_future_usage= off_session to set up a mandate to store and charge the customer's payment method later ( Called as 'CIT' : Customer initiated transaction)

curl --location 'http://sandbox.payswitcher.com/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: <enter your PaySwitcher API key here>' \
--data-raw '{
"amount": 0,
"currency": "USD",
"confirm": false,
"customer_id": "zero_auth_test_customer",
"email": "m.arjunkarthik@gmail.com",
"name": "John Doe",
"phone": "999999999",
"phone_country_code": "+1",
"description": "Its my first payment request",
"profile_id": <enter the relevant profile id>,
"setup_future_usage": "off_session"
}'
  1. Confirm the payment after collecting payment information from the user [You can skip this step if you are using the PaySwitcher Unified Checkout]

curl --location 'http://http://sandbox.payswitcher.com/payments/{{payment_id}}/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: <enter your PaySwitcher API key here>' \
--data-raw '{
    "confirm": true,
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4111111111111111",
            "card_exp_month": "01",
            "card_exp_year": "2035",
            "card_holder_name": "joseph Doe",
            "card_cvc": "100"
        }
    },
    "customer_id": "GC222",
    "setup_future_usage": "off_session",
    "payment_type": "setup_mandate",
    "customer_acceptance": {
        "acceptance_type": "online",
        "accepted_at": "1963-05-03T04:07:52.723Z",
        "online": {
            "ip_address": "127.0.0.1",
            "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
        }
    },
    "browser_info": {
        "ip_address": "172.0.0.1"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "9000000001",
            "country_code": "+91"
        }
    }
}'
  1. Retrieve the payment_method_id that was created against the above payment by retrieving the payment. You will get the payment_method_id in the response

curl --location 'https://sandbox.payswitcher.com/payments/<pass the payment_id>' \
--header 'Accept: application/json' \
--header 'api-key: <enter your PaySwitcher API key here>' \
  1. Charge the customer later by passing the payment_method_id (Called as 'MIT': Merchant initiated Transaction)

Pass the above payment_method_id under the recurring_details object along with off_session=true in the payments request and confirm the payment. Make sure you are using the same customer_id and profile_id from the CIT.

curl --location 'http://sandbox.payswitcher.com/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: use your PaySwitcher API key' \
--data-raw '{
    "amount": 1231,
    "currency": "USD",
    "confirm": true,
    "customer_id": "zero_auth_test_customer",
    "profile_id": <enter the relevant profile id>
    "off_session": true,
    "recurring_details": {
        "type": "payment_method_id",
        "data": "pm_lmTnIO5EdCiiMgRPrV9x"
    },
}'
PreviousPayout linksNextTokenization & saved cards

Last updated 11 months ago

🔀