How To Create A Payment Session To Get A Session ID

KeyferGoody
Visitor
2 0 3

Hey folks,

 

Our team is building an app for our sales channel and as part of this, we intend to use the Payments resource, enabling us to submit payment details directly to Shopify. 

 

While our app request for Payment Processing is currently being reviewed by the Shopify team, we are exploring the documentation and have gotten stuck. It seems as though the developer documentation references the ability to "create a payment session by submitting the card details to Shopify's card vault in exchange for a session ID", but we cannot find any documentation on which endpoint to use or what the payload is supposed to look like.

 

We've explored a few areas of documentation, but can't seem to find an answer here or anywhere else online:

 

  1. https://shopify.dev/api/admin-rest/2023-01/resources/payment#create_payment_session-2020-10. This one states that to complete a payment using the payment resource we can create a payment session by submitting the card details in exchange for a session ID but doesn't detail how to do this.
  2. https://shopify.dev/custom-storefronts/checkout/create#shopify-card-vault. This one states that "To get the vault ID to complete a payment, you need to send a POST request to the Shopify card vault, and provides a sample response, but doesn't detail what endpoint to use for the POST request, nor the payload shape.

 

Here's hoping someone might be able to point us in the right direction or share the steps they used to create a session ID from Shopify's card vault.

 

Best,

Replies 6 (6)

EcomGraduates
Shopify Partner
588 48 79

Hello  there  

 

To create a payment session by submitting card details to Shopify's card vault and exchange it for a session ID, you will need to use the Payments API. Here are the steps you can follow:

  1. Create a payment session using the POST /admin/api/2023-01/payment_sessions.json endpoint. The payload of the request should include the amount, currency, and payment_processing_application_id fields. The response of this request will include a session_id.

  2. Submit the card details to Shopify's card vault using the POST /admin/api/2023-01/cards.json endpoint. The payload of the request should include the vault_token, credit_card, and billing_address fields. The vault_token should be the session_id that was returned in the previous step.

  3. Once the card details have been submitted to the card vault, you can use the PUT /admin/api/2023-01/payment_sessions/{id}.json endpoint to update the payment session with the payment_details field. The payment_details field should include the payment_method and payment_method_nonce fields.

  4. Use the POST /admin/api/2023-01/payment_sessions/{id}/capture.json endpoint to capture the payment.

The Shopify developer documentation provides more detailed information on the payloads and response formats for each of these endpoints.

I hope this helps!

 

z04r
Shopify Partner
4 0 4

@EcomGraduates can you please share with me some docs or where do you find this endpoints and such? Because I'm literally finding nothing on the docs related to this endpoints you wrote.

 

I spent the last hour searching everything and I got to this post, but as I said, I can't find anything related to this endpoints on the docs. Where did you find this?

prakash10kce
Shopify Partner
1 0 4

@EcomGraduates : Is there any document available for above endpoints? currently i am not able to find any docs or reference . Please help

tentkeep
Shopify Partner
1 0 0

I believe this is the page people are looking for (I found it after hours of searching). It describes Stripe and Spreedly card tokenization, mentions Shopify Card Vault but no links to docs on how to take that more manual path... perhaps it is discouraged. Other options seem viable: https://shopify.dev/docs/apps/channels/checkout-api/complete-payment

Ashwani
Shopify Partner
3 0 1

Hello @EcomGraduates , can you please share the proper steps with Host, Body and all required details.

Here I am trying to achieve this past two weeks but no luck.

 

In Shopify there is no documentation about those apis which you have shared here.

 

Requesting you to assist us.

afrazkhan
Tourist
6 0 0

@KeyferGoody any luck with this, have you resolved the complete flow? We are also planning to use sales channel apps for payment processing but are unable to understand the flow from their docs. Please share the flow and APIs with which you have resolved this, thanks.