airwallex / airwallex-payment-demo Goto Github PK
View Code? Open in Web Editor NEWAirwallex payment element integration demo
Airwallex payment element integration demo
"Error: Forbidden
Your client does not have permission to get URL /assets/elements.bundle.min.js from this server."
This error is showing in Japan when accessing https://checkout.airwallex.com/assets/elements.bundle.min.js.
My Japanese customers are not able to make payment on my website using Airwallex because script is not accessible so it is showing error.
Hi I see that you have PHP integration as a coming-soon - is the intention to make an Omnipay or Payum module that we can use?
I'm considering using your payment gateway for my custom ecommerce platform (on https://www.sanchia.com.au ) but wanting to know how far away your PHP integration is or whether I'm better to write something myself.
If I write something myself I'm more than happy to release as open source so other PHP projects can use it.
Describe the bug
Setting the return_url
when creating a payment intent does not redirect the user back to that location after successful payment.
To Reproduce Steps to reproduce the behavior, better to provide the link to reproduce:
Expected behavior
You are redirected to the correct page.
Screenshots If applicable, add screenshots to help explain your problem.
Integration information:
language
element
Integration env (e.g. demo): Demo
IntentId:
Device (e.g. iPhone12):
OS (e.g. iOS8.1):
Browser (e.g. stock browser, safari):
Language:
Additional context Add any other context about the problem here.
airwallex-payment-demo/docs/recurring.md
Line 121 in 55f4688
Is there away to handle subscriptions via this plugin?
This question is related to:
language
element
We are currently trying to integrate your React frontend
const intent_id = "int_hkdmxqfgmgb1vkaeror";
const client_secret = "GUESSING API KEY";
const customer_id = "cus_hkdmpnqs7gb1swg8p2g";
const currency = "AUD";
const env = "demo";
const next_triggered_by = "merchant";
Now if I am correct the client_secret is where we put our API key, however we have done that using our demo airwallex account and we get the following error
{
"message": "Access denied, authentication failed",
"code": "unauthorized"
}
Now we are localhost testing, but I would not expect that to be the issue in this case.
We have copied and pasted the sample code from
https://codesandbox.io/s/airwallex-payment-demo-react-2m63j?file=/src/components/SplitCardRecurring.jsx
Update
Seems that client_secret is more than just the API key (which by the way needs to be authenticated before it is used in this plugin)
As now I am getting the following error
{
"code": "validation_error",
"message": "No 'customer_id' in client secret"
}
So steps to reproduce.
Step 1) take your API key and create session
curl --location --request POST 'https://api-demo.airwallex.com/api/v1/authentication/login' \
--header 'Content-Type: application/json' \
--header 'x-api-key: API KEY' \
--header 'x-client-id: CLIENT-KEY'
Step 2)
curl --location --request POST 'https://api-demo.airwallex.com/api/v1/pa/payment_methods/create' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Accept-Language: en-AU,en;q=0.9' \
--header 'Accept-Encoding: gzip, deflate, br' \
--header 'Origin: https://checkout-demo.airwallex.com' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15' \
--header 'Referer: https://checkout-demo.airwallex.com/' \
--header 'Content-Length: 197' \
--header 'Connection: keep-alive' \
--header 'Host: pci-api-demo.airwallex.com' \
--header 'client-secret: (AUTH KEY FROM STEP 1)' \
--header 'Priority: u=3, i' \
--header 'x-api-version: 2021-11-25' \
--header 'x-client-ip-source: awx-checkout' \
--header 'Awx-Tracker: 6251a8c0-23cb-47d0-a0da-ce9bc0fcd7fb' \
--data-raw '{"type":"card","card":{"number":"4111111111111111","cvc":"111","expiry_month":"10","expiry_year":"2022"},"customer_id":"cus_hkdmpnqs7gb1swg8p2g","request_id":"3c7541fc-a430-41b7-9a33-fc9b23615d58"}'
However the issue is that because it does not include the customer ID it fails.
How to create client_secret
So we worked out that the react plugin is not a simple include and run system. You still need to do a number of steps before you can use this plugin.
This should be documented clearer on this plugin (note all codes are in postman curl you can convert to node JS easy):
Step 1) Authenticate yourself by running
curl --location --request POST 'https://api-demo.airwallex.com/api/v1/authentication/login' \
--header 'Content-Type: application/json' \
--header 'x-api-key:API KEY' \
--header 'x-client-id: CLIENT KEY'
Step 2) Create the customer if they are not already in your system
curl --location --request POST 'https://api-demo.airwallex.com/api/v1/pa/customers/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer KEY FROM RESPONSE FROM STEP 1' \
--data-raw '{
"additional_info": {
"registered_via_social_media": false,
"registration_date": "2022-06-25"
},
"address": {
"city": "ADDRESS",
"country_code": "AU",
"postcode": "POSTCODE",
"state": "Western Australia",
"street": "STREET ADDRESS"
},
"business_name": "INSERT BUSINESS NAME",
"email": "THERE EMAIL ",
"merchant_customer_id": "USER/CUSTOMER ID",
"phone_number": "CUSTOMER PH NUMBER",
"request_id": "RANDOM UUIDV4"
}'
Step 3) Create payment intent
curl --location --request POST 'https://api-demo.airwallex.com/api/v1/pa/payment_intents/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer KEY FROM RESPONSE FROM STEP ' \
--data-raw '{
"amount": 200.00,
"currency": "AUD",
"customer_id": "CUSTOMER ID FROM AIRWALLEX",
"descriptor": "DESCRIPTION",
"merchant_order_id": "USER/CUSTOMER ID",
"order": {
"products": [
{
"code": "7719",
"desc": "DESCRIPTION OF PRODUCT",
"name": "NAME OF PRODUCT",
"quantity": 1,
"type": "virtual_goods",
"unit_price": 200.00,
"url": "PRODUCT URL"
}
],
"supplier": {
"address": {
"city": "CITY",
"country_code": "AU",
"postcode": "POSTCODE",
"state": "STATE",
"street": "STREET ADDRESS"
}
},
"type": "virtual_goods"
},
"payment_method_options": {
"card": {
"risk_control": {
"skip_risk_processing": true,
"three_domain_secure_action": "FORCE_3DS",
"three_ds_action": "FORCE_3DS"
},
"three_ds_action": "FORCE_3DS"
}
},
"request_id": "RANDOM UUID",
"return_url": "URL",
"risk_control_options": {
"skip_risk_processing": false
}
}'
Once you have done all those steps you should be able to get the response from that query and use it to create the card payment - However while I was able to accessfully do it via the postman, when I tried to do it by the embedded form I got the following which I don't fully understand.
{
"code": "invalid_status_for_operation",
"message": "The PaymentIntent status SUCCEEDED is invalid for operation confirm."
}
I am using vue to integrated dropIn element, while im trying to add listeners, I found that only 'onReady', 'onError', 'onSuccess' works fine. Nothing happened when im trying 'onChange' if i'd like to know if user type in any information via card method of dropIn element.
Btw, after init the dropIn element, onReady method told me the mount is finished and rendered, but I found that onReady will show me a positive response even the dropIn iframe not shown on the screen.
Please advice, thanks in advance.
This question is related to:
language
element
Hello
I create a Paymen Intent as follows
{ "amount": 100.01, "currency": "USD", "merchant_order_id": "126", "payment_method_options": { "card": { "risk_control": { "skip_risk_processing": false, "three_domain_secure_action": "FORCE_3DS", "three_ds_action": "FORCE_3DS" }, "three_ds_action": "FORCE_3DS" } }, "request_id": "126", "return_url": "http://www.example.com" }
Then I make the confirm API call
The return I get is:
{ "code": "validation_error", "source": "payment_method.type", "message": "payment_method.type must be provided" }
In the API description I don't see the parameter payment_method description!!!
Please tell me why and how to fix it
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior, better to provide the link to reproduce:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Integration information:
language
element
Integration env (e.g. demo):demo
IntentId:
Device (e.g. iPhone12):
OS (e.g. iOS8.1):
Browser (e.g. stock browser, safari):
Language:
Additional context Add any other context about the problem here.
There is an error when adding 3ds card and making a transaction when the transaction is successful, the white screen will show after transaction is successfull and no transaction results are returned. test card: 4012000300000062
Describe the bug I am trying to make a payment transaction using the customer's existing payment method using consent. I can't confirm payment intent if I add a payment_consent_id instead of element but the confirmPaymentElement() method still looking for the element eventhough I use a payment_consent_id
To Reproduce
confirmPaymentIntent({
payment_consent_id: 'your_payment_consent_id'
id: intent_id,
client_secret,
},
})
Expected behavior This should confirm the paymentIntent
Integration information:
language
element
Browser (e.g. stock browser, safari):
Language:
Issue
The demo sandbox linked from this page https://www.airwallex.com/docs/online-payments__hosted-payment-page - does not appear to be working.
When navigating to GitHub from https://www.npmjs.com/package/airwallex-payment-elements - the link to https://github.com/airwallex/airwallex-payment-elements produces a 404. This makes it challenging to know where, if anywhere, we should be logging issues when using the library.
Version
Using https://checkout.airwallex.com/assets/elements.bundle.min.js as import is failing, refer to #75
Issue
Our call looks like the below:
Airwallex.redirectToCheckout({
env: 'demo', // Which env('staging' | 'demo' | 'prod') you would like to integrate with
intent_id: data.id,
client_secret: data.client_secret,
currency: 'AUD',
});
RedirectToCheckout produces a blank airwallex page: https://checkout-demo.airwallex.com/#/standalone/checkout/undefined?currency=AUD&from=http://localhost:3000&sessionId=bfbdec2c-ad2c-4766-a178-de22f13e7627
Notes
Sidenote: attempting to use versioned hosted bundles that are versioned, e.g. https://checkout.airwallex.com/assets/bundle.0.2.103.min.js - does not appear to work as expected as this serves a HTML page, not the library.
The react example:
axios
.eslintrc.js
tells prettier to error if not using single quotes, but double quotes are used throughout the exampleCard.jsx
aren't declared properly (e.g. onFocus
, onBlur
)inputErrorMessage
isn't included in useEffect
's dep array in SplitCard.jsx
The react-ts example:
npm install
without --force
because the versions of react-scripts
& typescript
conflictredirectToCheckout
or createElement
; tried to fix this but ended up getting confusion between id
& intent_id
so I think maybe it's just using an old version of the lib or types?I recently went through the docs for the Hosted Payments Page and after setting up my server to create the Payment Intent, it was confusing why there was no order summary on the left despite the gif in the demo page showing one.
After reading the API docs a bit more for the payment intent, and what I gather is that there is an "order" field that needs to be populated with this information. I think this should be expressed somewhere in these integration docs.
Why is the Airwallex initiation logged twice on the demo website ?
Try checkout some items from the demo page here - https://demo-pacheckoutdemo.airwallex.com/
This question is related to:
language
element
Describe the bug
I have started to integrate the Split Card from airwallex-payment-elements,
but failed to change the return_url when 3DS is triggered.
I am testing with https://api-demo.airwallex.com.
To Reproduce
{
"amount": 10,
"currency": "HKD",
"merchant_order_id": "TEST-ID",
"request_id": "REQUEST_ID",
"payment_method_options": {
"card": {
"three_ds_action": "FORCE_3DS"
}
},
"return_url": "http://www.example.com"
}
await confirmPaymentIntent({
element: cardNumElement,
id: "INTENT_ID",
client_secret: "CLIENT_SECRET",
payment_method_options: {
card: {
auto_capture: true,
three_ds: {
return_url: 'http://www.example.com'
}
},
}
})
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Integration information:
language
element
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.