I Need help about: ERROR_CREATE_PAYMENT

Hello everyone, I meet a problem
when I clicking place order button after creating checkout page, the page send out an ajax,
And this ajax reponds with 400, the detial is following:
{“status”:{“error_code”:“ERROR_CREATE_PAYMENT”,“status”:“ERROR”,“message”:"",“response_code”:“ERROR_CREATE_PAYMENT”,“operation_id”:"…"}}
Request URL is
https://api.rapyd.net/v1/checkout/checkout_

I really don’t know why, could anybody help please?

1 Like

@Jax.Yang - Please post the complete request (URL and body of the request). Was this in sandbox or production?

1 Like

Hi @CharlesDorsett ,
This is in production,
request url is: https://api.rapyd.net/v1/checkout/checkout_00835dd26835ba0415e7c88e656da443
request payload is {"payment_method":{"type":"jp_711_cash","name":"","address":null,"metadata":{},"fields":{"name":"test","phone_number":"12345678"}},"client_details":{"session_id":"checkout_00835dd26835ba0415e7c88e656da443","device_timezone":"GMT+0800","operating_system":"Windows","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36","device_fingerprint":"633d00ce5f549549b61a2cd3a16f86f6","language":"zh-CN","java_enabled":false,"javascript_enabled":true,"screen_color_depth":24,"screen_height":960,"screen_width":1536,"window_height":809,"window_width":942,"timezone_offset":-480},"payment_method_options":{},"customer_required_fields":{},"selected_currency":"JPY","selected_category":"cash","cancel_fixed_side_buy":false}

1 Like

Hi @Jax.Yang - I can see several problems - I’m using Create Checkout Page as a reference.

First, post https://api.rapyd.net/v1/checkout/{{checkout}} is not a supported endpoint. To create the checkout page, you have to use https://api.rapyd.net/v1/checkout

Second, your payload is missing several required parameters:

  • amount
  • country
  • currency

Third (not related to your error, but …) you have included a lot of fields that are not documented in the API Reference. I don’t think these will affect the request, but I’m curious to know where you got these fields and values from.

1 Like

Hi @CharlesDorsett, sorry, I think I didn’t explain well, I did use endpoint https://api.rapyd.net/v1/checkout to create a checkout page, after I get the redirect_url from response value and open the checkout page in Chrome, and then clicking button “Place Your Order”, the page popup an error,

So I check “Network” and found an error ajax send by Rapyd, which I mentioned when this topic started

And this error stop me to continue my following payment

I think you should open a support ticket at https://support.rapyd.net/ - they can look into the logs and find out exactly what went wrong.

:grinning: Alright, thanks for the advices @CharlesDorsett

2 Likes

Hey @Jax.Yang let us know here in the community what you find out from support and feel free to post the answer back here. Hope if gets worked out soon for you.

2 Likes

Hi @Jax.Yang did you open a ticket ?

ok, thanks, I will post the answer once I figure this out

1 Like

@Jax.Yang When you get Error with Status Code 400, it simply indicates that the server cannot process the request due to some malformed request syntax, invalid request message framing or deceptive request calls.

If you can share the portion of the code that are causing the issue, it will be easier for us to find the exact solution to your problem. What language are you
using at backend.

Hope to hear from you soon

1 Like

Hi @fredjinbility, I think the problem is not in my codes which requesting Rapyd endpoint, because the error ajax is send by Rapyd’s js code from the checkout page. I have opened a ticket several days ago in the support center of Rapyd Client Portal, they said they are investgating:


I hope they can give me a solution ASAP. :pensive:

@Jax.Yang, Thanks for getting back and I wish you are good.

Just a hint, while your issues is being investigated by Rapyd Support Team via your submitted ticket.

Please, I just want you to also check two things from your own end.

1.)Ensure that your ajax call is not blocked via access contol origin request

2.) Ensure that your application does not sends the OPTIONS preflight request (which has no body) before the POST.
This is to ensure that your ajax call does not try to pass non-existent body parameters from OPTIONS to the Rapyd API,
resulting in an exception caught by your catch handler, which responds with a 400 status error code.

3.) I will post a working ajax call solution in a mean time so that you can try it out and compare it to yours.

Thank you

1 Like

Hi @Jax.Yang, this is a Dynamic working sample with jquery/ajax and php
Here is how it works.

When a User Click on the Purchase button, An Ajax Call is used to Post the Purchased items to dynamically generate a Payment Checkout Page Id on the fly by passing the data to Process_checkout.php. If the Checkout Page is successfully created, Then Rapyd Payment System is loaded for user to complete Payments.

Upon Visa or Master Card Payments, An Ajax Call is automatically made to Rapyd Checkout Retrieval API to update and get Payments ID, Payment Status etc.

If Other Payments method other than Card is used, Upon Payments, The User will be redirected to Rapyd Payments Completion Page to complete his Payments and payments status and other details are automatically fetched…

Here is the steps for testing:

1.)Edit settings.php to configure your Rapyd Payments API details, Languages, Payment methods etc. where appropriates.

2.) Edit Rapyd_access_keys.php to configure your Sandbox Rapyd Access Keys and Secret.

To use it in production, You can also change the API URL to point to productions API Endpoint and also remember to enter access credentials for Productions.

3.) Whatever Payment method that you configure in setting.php must correspond dynamically with the one coded in the process_checkout.php. please see this line of code


"payment_method_types_include"  => [
$payment_method_types_include_grabpay,
    "$payment_method_types_include_visacard",
   "$payment_method_types_include_mastercard",

    ]
];

You can call up browser and test your code at

http://localhost/rapyd_ajax/index.php

You can download sample from my google drive Drive Sample

If have any further problem, let me know. Thanks

Hi @fredjinbility Thanks for the help and code share :handshake:. And I did some tests, I found there is only one cash payment method is working which is “jp_familymart_cash”, and other JP cash method will return ajax 400 error, this really confuse me. :joy:
I still think the problem is not in the code level, I hope Rapyd support center can reply me ASAP.

1 Like

Thanks for getting back @Jax.Yang, I have tested the Payments method supported by Rapyd for Japan and all the payments are going through and working fine. There is no ajax error code on my own end

Here is the 17 method of payments supported by Rapyd for Japan


 jp_711_cash 
jp_lawson_cash 
jp_familymart_cash
jp_ministop_cash 
jp_seicomart_cash
jp_diners_card
jp_banktransfer_bank 
jp_credit_card
jp_softbankphysical_carrier_ewallet 
jp_amex_card 
jp_docomophysical_carrier_ewallet
jp_mastercard_card 
 jp_visa_card 
jp_softbankdigital_carrier_ewallet 
jp_famipay_ewallet
jp_jcb_card
jp_docomodigital_carrier_ewallet

I have launched the testing sample online so that you can test the code and see that all Payments are working fine.
Online Testing Sample

I will take the link down as soon as testing is done. Thank You…

Hi @fredjinbility, thanks for the link :handshake:. I tried and it’s successful indeed.

But my problem occured in production environment, not sandbox. I also did my test in sandbox environment, there is no error indeed. I think there is some differences between Raypd sandbox and Rapyd prodcution environment.

BTW, I compared the ajax’s payload between sandbox and production, they are almost same, only endpoints have different domain.

This is sandbox: https://sandboxapi.rapyd.net/
This is prod: https://api.rapyd.net/

1 Like

Do you need any more help ?

Thanks @Daniel_Rojansky , now I think the only thing I can do is waiting

@CharlesDorsett can you help ?