Create new payment 404 error response

New Member
2 0 0

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
839 82 125

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