Global API
...
Subscription
Subscription - Square
Create
1min
to create a subscription in the square, use the action “createsubscription” and pass the subscription data in the requestjson under “subscriptions ” note you can only create one record at a time here is an example of creating a subscription where we are setting every possible field(see https //app archbee io/docs/ lihuunv 7xnqrtzhskkc/hnjmkn99qxwdeafyyifsq subscription square docid\ wku2grtlfpcljd9tmx4ep for all the available fields) the response will return the response from square, which includes the subscription id ( internalid ) plus the newly created salesforce subscription id ( salesforceid ) map\<string, object> subscriptiondata = new map\<string, object>(); // required fields subscriptiondata put('processorcustomerid', 'processorcustomerid'); //required subscriptiondata put('locationid', 'locationid'); //required to square, if not specified we are sending a request to square to get the main square location id subscriptiondata put('processorplanid', 'processorplanid'); //required // optional fields subscriptiondata put('processorpaymentmethodid', 'processorpaymentmethodid'); // if not specified, the collection method will be considered “send invoice” subscriptiondata put('startdate', 'startdate'); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('subscriptions', new list\<object>{subscriptiondata}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version','1 0'); reqobj put('action','createsubscription'); reqobj put('processorid', 'processorid'); reqobj put('requestjson',reqjson); // placing a request to breadwinner global api map\<string,object> resp = bw payments breadwinnerpaymentsapi call(reqobj); system debug(resp); { "action=createsubscription", "version=1 0", "responsejson=", { "subscriptions" \[ { "status" "active", "salesforceid" "salesforceid", "salesforcecustomerid" "salesforcecustomerid", "salesforcecontact" null, "salesforceaccount" "salesforceaccount", "processorsubscriptionid" "processorsubscriptionid", "processorpaymentmethodid" null, "processororgid" "processororgid", "processorcustomerid" null, "latestinvoice" null, "errormessage" null, "currentperiodstartdate" null, "currentperiodenddate" null, "createdvia" "breadwinner", "createddateinprocessor" "2023 06 06t08 11 09 000z", "collectionmethod" "send invoice", "timezone" null, "taxpercentage" null, "startdate" null, "processorplanid" null, "price override money" null, "locationid" null, "canceleddate" null } ] }, "statuscode=200", "timestamp=1686039070310", "validrequest=true" }