Global API
...
Checkout URL
Checkout URL - Square

Create

1min
to create a checkout url in square, use the " createcheckouturl" action you need to prepare a request object and a list of line items the request object should include the customer id, checkout type, and whether tipping is allowed each line item should include the quantity, unit price, item currency, name, and note see the checkout url square docid\ ur1nlvltspy93xugrkgvn for all required fields please note that you can only request one checkout url at a time this will return a response that includes the new square checkout url the following is an example of a checkout url for square request // create a map to store all the data of a customer map\<string, object> checkoutmap = new map\<string, object>(); //checkoutmap put('locationid',locationid); // if not entered, we will request to square and fetch the main location id checkoutmap put('customerid',customerid); checkoutmap put('checkouttype', 'ordercheckout'); checkoutmap put('allowtipping', true); //creating the line items map\<string,object> line item = new map\<string,object>(); line item put('quantity', '5'); line item put('unitprice', '100'); line item put('itemcurrency', 'usd'); line item put('name', 'ball'); line item put('note', 'to play cricket'); map\<string,object> line item1 = new map\<string,object>(); line item1 put('quantity', '1'); line item1 put('unitprice', '75000'); line item1 put('itemcurrency', 'usd'); line item1 put('name', 'laptop'); line item1 put('note', 'for gaming'); list\<object> line items = new list\<object>(); line items add(line item); line items add(line item1); // adding the line items checkoutmap put('lineitems', line items); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('checkout', new list\<object>{checkoutmap}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'createcheckouturl'); reqobj put('processorid',processororgid); reqobj put('requestjson', reqjson); // placing a request to breadwinner global api map\<string, object> resp = bw payments breadwinnerpaymentsapi call(reqobj); system debug(resp); response { action=createcheckouturl, timestamp=1599492195202, validrequest=true, version=1 0, statuscode=200, responsejson={ { "payment link" { "id" "paymentlinkid", "version" 1, "order id" "orderid", "checkout options" { "allow tipping"\ true }, "url" "https //sandbox square link/u/gtxpl9jt", "created at" "2022 09 06t09 07 11z" }, "related resources" { "orders" \[ { "id" "5cc7rivonpqw9fmy6udk2vkxjg4f", "location id" "location id", "source" { "name" "sandbox for sq0idp qwdpt7r4zacy82lu9uh1ng" }, "customer id" "customer id", "line items" \[ { "uid" "llf17bylfafnrhfxfk5v8b", "name" "checkout1", "quantity" "1", "note" "test checkout", "item type" "item", "base price money" { "amount" 12345, "currency" "usd" }, "total money" { "amount" 12345, "currency" "usd" } } ], "net amounts" { "total money" { "amount" 12345, "currency" "usd" } }, "created at" "2022 09 06t09 07 10 941z", "updated at" "2022 09 06t09 07 10 941z", "state" "draft", "version" 1, "total money" { "amount" 12345, "currency" "usd" } } ] } } } }