question

globaliwebsite avatar image
globaliwebsite asked David Marginian Deactivated edited

pay for order error on sandbox

Hello,


Following documentation to generate token, create order and pay for order, on the last steps its giving error can you please guide me what i am doing wrong


1. I generate card token using this end point

https://docs.clover.com/docs/ecommerce-accepting-payments#paying-for-an-order


This is the return

Card token Generate
============================

{
"id":"clv_1TSTS1triFHZoXCqZAYbmUjx"
"object":"token"
"card":{
"exp_month":"12"
"exp_year":"2021"
"first6":"424242"
"last4":"4242"
"brand":"VISA"
}
}



2. I post order- using this end point

https://docs.clover.com/reference/orders#postorders


This is the return

POST order
================
{
"id":"NYR6DBS1WQMAG"
"object":"order"
"amount":1800
"currency":"usd"
"created":1603989316000
"customer":"NPF9JX196QAE2"
"email":"globaliwebsite@gmail.com"
"items":[
0:{...}
1:{...}
]
"shipping":{
"name":"nausheen imtiaz"
"phone":"0000000"
"address":{...}
}
"status":"created"
}



2. Pay for and order I used this end point but its failing not sure why

https://docs.clover.com/reference/orders#postordersidpay


This is the what i am sending

var client = new RestClient("https://scl-sandbox.dev.clover.com/v1/orders/NYR6DBS1WQMAG/pay");
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer 2581a7d1-80db-acb7-871c-14a84ab1472d");
request.AddParameter("application/json", "{\"ecomind\":\"ecom\",\"external_reference_id\":\"00125\",\"source\":\"clv_1TSTS1triFHZoXCqZAYbmUjx\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

Order ID: which i generated in step 2

Source: is the id i generated in step 1


but it gives following error please advice me

Your OAuth2 token is incorrect or has expired

Please advice me on step 3 what is wrong, the bearer key I passed is working fine when i generated the tokenized on step 1 not sure why not working to pay

Orders
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated edited

https://docs.clover.com/docs/ecommerce-app-permissions

Different endpoints require different permissions.

2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

globaliwebsite avatar image globaliwebsite commented ·

I want to charge for an order can you guide me In pay for and order end point

https://docs.clover.com/reference/orders#postordersidpay


What i have to pass in Source Field? please guide me.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ globaliwebsite commented ·

Source is a tokenized card that you obtained via the iframe. Please see the iframe docs.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community