Create new payment 404 error response

12 0 2

Hello All,


I'm trying to create a new payment using sales channel api using this tutorial:

but I'm getting 404 error.


First of all I created a checkout using this:[version]=2019-10#create-2019-1... and got the checkout ID.


Then I stored the credit card in the vault and got the session ID using this:


Then using the checkout ID and session ID i'm trying to create the payment but I'm getting the 404 response. I'm trying from the localhost. Please let me know if the payment work if I try from my localhost.


This is the code I tried:


$url2 = "";

// I have removed the api & secret key
$method2 = "POST";

$local_ip = getHostByName(php_uname('n'));
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$accept_language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];

$postData_payment_1 = array ('payment' => array ('request_details' => array ('ip_address' => $local_ip, 'accept_language' => $accept_language, 'user_agent' => $user_agent, ), 'amount' => '10', 'session_id' => $credit_card_vault_session_id, 'unique_token' => 'token I received when I installed the app from the partner a/c to shop', ) );

$postData_payment = json_encode($postData_payment_1);

$curl = curl_init($url2);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_MAXREDIRS, 3);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
// curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 3);
// curl_setopt($curl, CURLOPT_SSLVERSION, 3);
curl_setopt($curl, CURLOPT_USERAGENT, 'My New Shopify App v.1');
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method2);

curl_setopt($curl, CURLOPT_POSTFIELDS,$postData_payment);

$response2 = curl_exec($curl);
$error_number2 = curl_errno($curl);
$error_message2 = curl_error($curl);
// Close cURL to be nice





Here is the response I received:


HTTP/2 404
date: Wed, 09 Oct 2019 14:59:00 GMT
content-type: application/json; charset=utf-8
set-cookie: __cfduid=d6358657c89b5afe584709a818bc1a3e61570633140; expires=Thu, 08-Oct-20 14:59:00 GMT; path=/;; HttpOnly
x-sorting-hat-podid: 63
x-sorting-hat-shopid: 21444296768
vary: Accept-Encoding
referrer-policy: origin-when-cross-origin
x-frame-options: DENY
x-shopid: 21444296768
x-shardid: 63
x-stats-apiclientid: 3161903
x-stats-apipermissionid: 193724481600
x-shopify-api-terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at
strict-transport-security: max-age=7889238
x-request-id: b980db70-4d9f-4b2f-884e-eddecee5293e
x-shopify-stage: production
content-security-policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fcheckouts%2Fpayments&source%5Bsection%5D=admin_api&source%5Buuid%5D=b980db70-4d9f-4b2f-884e-eddecee5293e
x-content-type-options: nosniff
x-download-options: noopen
x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block; report=/xss-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fcheckouts%2Fpayments&source%5Bsection%5D=admin_api&source%5Buuid%5D=b980db70-4d9f-4b2f-884e-eddecee5293e
x-dc: gcp-us-east1,gcp-us-east1
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri=""
server: cloudflare
cf-ray: 52313747cbacaae0-MAA

{"errors":"Not Found"}


Thanks in advance.



Shopify Partner
948 97 152

That is odd. One note, though I am not sure that is related, the value for unique_token should be unique across all payments created. Definitely, you must not use the token you've got while installing the app. It should be a random, unique value.

Sergiu Svinarciuc | CTO @
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to or our blog


Community Manager
Community Manager
618 45 81


Hi @aruninnoppl,


Your app does not have access to payment processing, but I can see you requested it. You'll need to wait until your request is complete before you can start payment processing through your app.



12 0 2

Thanks, Sergiu. Yes, the token was wrong and now I corrected it. I appreciate your help.

12 0 2

Thanks Busfox. Yes the requested was not accepted so it was showing the 404. Thanks for your help.

12 0 2

Hello Busfox,


My payment processing request was rejected/failed since it was a single store. They said like it will be enabled only for the merchant sites. So I wasn't able to continue the payment process.


1. Is there any way I can process the payment?


2. I see a weburl is generated when creating a checkout and if I access that url, it takes me to the store checkout page. But the problem is after the payment is made, it doesn't bring me back to my website, it stays on the shopify store checkout only with the thank you message. Is there a way I can redirect them to my website where I created the this checkout process?


3. Any other idea I can solve this?


Thanks in advance.