WooshPay OpenAPI
Product DocumentAPI ReferenceJS SDK ReferenceSaaS Platform Integration
Product DocumentAPI ReferenceJS SDK ReferenceSaaS Platform Integration
Back to WooshPay Website
  1. Online payments
  • Online payments
    • Quick Start
    • Integration overview
    • Wooshpay JS SDK
    • Wooshpay Checkout
    • Wooshpay Direct API
    • Payment Link
    • Authorize and capture
    • Build subscriptions integration
    • Testing cards
  • After the payment
    • Payouts
    • Webhook
    • Check the webhook signatures
    • 校验webhook签名
  • Add more payment methods
    • Supported payment method
    • Cards
    • Wallets
      • Alipay
      • Alipay HK
      • Apple Pay
      • Google Pay
      • Wechat Pay
      • 微信支付
      • Kakao Pay
      • DANA
      • Boost
      • Grabpay
      • Mcash
      • Touch'n Go
      • ShopeePay
      • UnionPay
      • 9Pay
      • OVO
      • GCash
      • TrueMoney
    • Bank redirects
      • Bancontact
      • BPI
      • Trustly
      • EPS
      • Giropay
      • iDEAL
      • Przelewy24
      • FPX
    • Buy Now Pay Later
      • Klarna
    • Bank Debits
      • Sepa Direct Debit
    • Bank Transfer
      • Bank Transfer in Europe
      • Bank Transfer in United Kingdom
      • Bank Transfer in Indonesia
    • QR Payments
      • QRIS
      • PromptPay
    • Real-time payments
      • PIX
      • PayNow
      • UPI
      • SPEI
  • More payment scenarios
    • Set up future payments
    • Save payment method during payment
  • SaaS platform integration
    • Shopify Plugin
    • Shopastro 星盘
    • WooCommerce
    • Shoplazza 店匠
    • Shopline Plugin
    • Sage Connection
  • Resources
    • Supported currencies
  1. Online payments

Wooshpay Checkout

Overview#

There are two steps to creating a complete checkout:
1.
Create a Checkout
2.
Determine the payment result

Create Checkout#

A Checkout Session is the programmatic representation of what your customer sees when they’re redirected to the payment form. You can configure it with options such as:
line_items to charge
currencies to use
You also need to specify:
A success_url, a page on your website to redirect your customer after they complete the payment.
The success_url cannot be used as the sole condition for determining payment success. Please focus on the status of the Checkout object and the corresponding PaymentIntent status as the basis for determining the payment result.
A cancel_url, a page on your website to redirect your customer if they click on your logo in Checkout.
Note: Checkout Sessions expire 24 hours after creation.
Request
{
    "cancel_url":"www.example.com",
    "mode":"payment",
    "success_url":"www.wooshpay.com",
    "line_items":[
        {
            "price_data":{
                "currency":"GBP",
                "unit_amount":5,
                "product_data":{
                    "name":"example product",
                    "description":"very delicious"
                }
            },
            "quantity":1
        }
    ]
}
Response
{
    "id":"cs_1580071142008291328",
    "object":"checkout.session",
    "created":1665553291000,
    "currency":"GBP",
    "customer":"",
    "mode":"payment",
    "livemode":false,
    "shipping":null,
    "status":"open",
  "url":"https://checkouttest.wooshpay.com/pay/cs_test_1580071142008291328?key=pk_test_dGVzdDpXWUg1eUF4OXZpUUF4UHNoYmdRRjVTTTE=",
    "cancel_url":"www.baidu.com",
    "client_reference_id":null,
    "customer_email":null,
    "line_items":{
        "object":"list",
        "data":[
            {
                "id":"li_1580071142847152128",
                "object":"item",
                "currency":"GBP",
                "description":"example product",
                "price":{
                    "id":"price_1580071142859735040",
                    "object":"price",
                    "created":1665553291000,
                    "active":true,
                    "currency":"GBP",
                    "product":{
                        "id":"prod_1580071142880706560",
                        "object":"product",
                        "created":1665553291000,
                        "active":true,
                        "description":"some description",
                        "name":"example product",
                        "updated":1665553291000,
                        "images":null
                    },
                    "type":"one_time",
                    "livemode":false,
                    "unit_amount":5
                },
                "quantity":1,
                "amount_subtotal":5,
                "amount_total":5
            }
        ],
        "url":null,
        "has_more":null
    },
    "payment_intent":"pi_1580071150141046784",
    "payment_method_types":null,
    "payment_status":"unpaid",
    "success_url":"www.wooshpay.com",
    "amount_subtotal":5,
    "amount_total":5,
    "billing_address_collection":"auto",
    "expires_at":1665639691214,
    "payment_link":"",
    "payment_method_options":null,
    "phone_number_collection":null,
    "shipping_address_collection":null,
    "client_secret":"pi_1580071150141046784_secret_bsOGcAMewpe6orzCbZHMlomu"
}
Redirect the URL
After creating a Checkout Session, redirect your customer to the URL returned in the response.

Determine the payment result#

There are two ways to retrieve the payment result:
1.
Get the payment result via Create a Webhook
Please monitor events such as ‘payment_intent.created’ and ‘payment_intent.succeeded’. We will send you a callback notification whenever there is a change in the payment status.
2.
Retrieve the payment result through the Retrieve a PaymentIntent
ou can query the specific PaymentIntent status through the Retrieve a PaymentIntent API. The status field will indicate the current state of the payment. If the status = succeeded, it means the PaymentIntent was successful.

Next step#

Create a Webhook#

Listen to events on your WooshPay account so your integration can automatically trigger reactions. Create a webhook that mainly focuses on enabled_events and url.

Create a Refund#

Create a refund to repay funds to your customer. You can also perform partial refunds, but not every payment method supports them. A partial refund is when you refund only part of the original transaction amount.
Modified at 2025-02-20 04:13:02
Previous
Wooshpay JS SDK
Next
Wooshpay Direct API
Built with