Global API
...
Checkout URL
Checkout URL - Stripe
Create
1min
to create a checkout url in stripe, use the " createcheckouturl" action you need to prepare a request object and a list of line items the request object should include the mode, processorid, and action see the checkout url stripe docid\ oiusbofbkcn2aoktybdj7 for all required fields please note that you can only request one checkout url at a time the resp will return a response that includes the new stripe checkout url the following is an example of a checkout url for stripe request map\<string, object> checkoutmap = new map\<string, object>(); // /you may only specify one of these parameters 'customerid', 'customeremail' //checkoutmap put('customerid', stripecustomerid); checkoutmap put('customeremail', customeremail); checkoutmap put('mode', 'payment'); checkoutmap put('paymentmethodtypes', new list\<string>{'card'}); checkoutmap put('successurl', 'https //example com/success'); checkoutmap put('cancelurl', 'https //example com/cancel'); list\<object> lineitemslist = new list\<object>(); // the line items parameter is required in payment and subscription mode, it's not required in setup mode // amount, quantity, currency and name are required for line item's price data // subscriptions require at least one recurring price or plan to be passed to line items and quantity map\<string,object> lineitemmap1 = new map\<string,object>(); //lineitemmap1 put('processorpriceid', processorpriceid); lineitemmap1 put('quantity', 1); lineitemmap1 put('unitprice', 100); lineitemmap1 put('itemcurrency', 'usd'); lineitemmap1 put('name', 'item1'); map\<string,object> lineitemmap2 = new map\<string,object>(); //lineitemmap2 put('processorpriceid', processorpriceid); lineitemmap2 put('quantity', 2); lineitemmap2 put('unitprice', 120); lineitemmap2 put('itemcurrency', 'usd'); lineitemmap2 put('name', 'item2'); lineitemslist add(lineitemmap1); lineitemslist add(lineitemmap2); checkoutmap put('lineitems', lineitemslist); map\<string,object> paymentintentmetadata = new map\<string,object>(); paymentintentmetadata put('order id', 'abc123'); // any key value pair checkoutmap put('payment intent metadata', paymentintentmetadata); // add subscriptiondata only in subscription mode map\<string,object> subscriptiondata = new map\<string,object>(); //you can only specify one of these parameters trialend, trialperioddays datetime dt = datetime newinstance(2022, 8, 30); //subscriptiondata put('trialend', dt); subscriptiondata put('trialperioddays', 2); map\<string,object> subscriptonmetadata = new map\<string,object>(); subscriptonmetadata put('sub id', 'test 123'); // any key value pair subscriptiondata put('subscriptionmetadata', subscriptonmetadata); checkoutmap put('subscriptiondata', subscriptiondata); 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', stripeprocessororgid); 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, version=1 0, responsejson={ "id" "cs test b1bkbh5uekr9cdaxmwmgo9pmmdbi3vdlkfj5t0vhejwk8mtkgdh2adaxlu", "object" "checkout session", "after expiration" { "recovery" { "allow promotion codes" false, "enabled" true, "expires at" 1664000753, "url" "https //buy stripe com/r/test ywnjdf8xr2i1te1drzkzngzsehjylf9nskj0sgn5t3hrrmdrq2vkdjvmyvpsclmxt1rasvhm0100w22hgstn" } }, "allow promotion codes" null, "amount subtotal" 340, "amount total" 340, "automatic tax" { "enabled" false, "status" null }, "billing address collection" null, "cancel url" "https //example com/cancel", "client reference id" null, "consent" null, "consent collection" null, "currency" "usd", "customer" "cus mgbxfvs5jaq1cd", "customer creation" null, "customer details" null, "customer email" null, "expires at" 1661495152, "livemode" false, "locale" null, "metadata" {}, "mode" "payment", "payment intent" "pi 3lazvlcg934flxrx1mr61hmb", "payment link" null, "payment method collection" "always", "payment method options" {}, "payment method types" \[ "card" ], "payment status" "unpaid", "phone number collection" { "enabled" false }, "recovered from" null, "setup intent" null, "shipping" null, "shipping address collection" null, "shipping options" \[], "shipping rate" null, "status" "expired", "submit type" null, "subscription" null, "success url" "https //example com/success", "total details" { "amount discount" 0, "amount shipping" 0, "amount tax" 0 }, "url" null }, statuscode=200, timestamp=1661408754570, validrequest=true }