Skip to main content

Alipay via Adyen

Alipay is a leading Chinese digital payment platform that enables secure and convenient online payments. Through Adyen's integration, you can accept Alipay payments from customers worldwide.

Setup

Please follow the common Adyen instructions to get set up with Adyen. Next, make sure to enable Alipay as a payment method on your configured account.

Integration

API Request

curl --request POST \
--url https://api.efundpay.com/v4/transactions \
--header 'Authorization: Bearer <token>' \
--header 'x-merchant-account-id: <x-merchant-account-id>' \
--header 'Content-Type: application/json' \
--data '{
"amount": 10000,
"currency": "CNY",
"payment_method": {
"method": "adyen",
"payment_method_data": {
"type": "alipay",
"returnUrl": "https://yourdomain.com/return"
}
},
"external_identifier": "order-12345"
}'

Payment Flow

  1. Initialize Payment - Create payment request with EFundPay
  2. Redirect to Alipay - Customer is redirected to Alipay payment page
  3. Payment Processing - Customer completes payment on Alipay
  4. Return to Merchant - Customer returns to your site
  5. Webhook Notification - Receive payment status via webhook

Configuration

Required Parameters

  • amount - Payment amount in smallest currency unit (fen for CNY)
  • currency - Currency code (CNY for Chinese Yuan)
  • payment_method_data.type - Set to "alipay"
  • returnUrl - URL to redirect customer after payment

Optional Parameters

  • billing_address - Customer billing address
  • shipping_address - Customer shipping address
  • merchant_order_id - Your internal order reference

Response Handling

Success Response

{
"type": "transaction",
"id": "txn_123456789",
"status": "processing",
"payment_url": "https://checkoutshopper-test.adyen.com/checkoutshopper/...",
"external_identifier": "order-12345"
}

Webhook Notification

{
"ll_transaction_id": "2022012601122644",
"merchant_transaction_id": "order-12345",
"payment_data": {
"payment_status": "PS",
"payment_amount": "100.00",
"payment_currency_code": "CNY",
"payment_time": "20220126141430",
"adyen_psp_reference": "8535296650153317",
"result_code": "Authorised"
}
}

Client-Side Integration

Redirect to Payment

// Redirect customer to Alipay payment page
function redirectToAlipay(paymentUrl) {
window.location.href = paymentUrl;
}

// Handle payment return
function handlePaymentReturn() {
const urlParams = new URLSearchParams(window.location.search);
const resultCode = urlParams.get('resultCode');

if (resultCode === 'Authorised') {
showSuccessMessage('支付成功!');
} else {
showErrorMessage('支付失败,请重试。');
}
}

Testing

Adyen has instructions on how to test Alipay. You can use the following test scenarios:

  • Successful Payment - Complete payment flow successfully
  • Payment Cancelled - Customer cancels the payment
  • Payment Failed - Payment fails due to insufficient funds or other reasons

Test Environment

  • Use Adyen's sandbox environment for testing
  • Test with various amounts and currencies
  • Verify webhook notifications
  • Test return URL handling

Security Considerations

  • Always use HTTPS for all communications
  • Validate webhook signatures
  • Implement proper session management
  • Follow Alipay's security guidelines

Best Practices

User Experience

  • Provide clear payment instructions in Chinese
  • Show payment progress indicators
  • Handle errors gracefully
  • Optimize for mobile devices

Technical Implementation

  • Implement proper error handling
  • Use webhooks for real-time updates
  • Store transaction references
  • Handle network failures gracefully

Common Issues

Payment Failures

  • Invalid Amount - Ensure amount is in correct format
  • Currency Issues - Check currency settings
  • Return URL Issues - Verify return URL configuration

Integration Issues

  • Webhook Not Received - Check webhook endpoint and signature
  • Payment Page Error - Verify payment URL generation
  • Authentication Issues - Check API credentials

Support

For technical support with Alipay via Adyen integration:

  • EFundPay Support - Contact our technical team
  • Adyen Support - Use Adyen's support resources
  • Alipay Documentation - Comprehensive integration guide
Powered by Docusaurus