Subscription

Creating subscriptions

Endpoint

https://api.grubpay.io/v4/auth

Method:

POST

Content-Type: application/json;charset=UTF-8

Important

If startDate is not included in the request: a startDate of the current date will be configured for this subscription and a payment will be made immediately with proceeding payments following the recurring frequency

Request
NameRequiredTypeSampleDescription
mchIdyString10000701assigned by GrubPay
mchOrderNoyString1234567890abcassigned by merchant
tokenyStringassigned by GrubPay
recurringyString[w,2w,4w,m]current possible configurations are weekly, bi-weekly,every 4 weeks (28 days) or monthly (set day each given month)
startDatenInt1684145800the UNIX timestamp (seconds) for the first recurring payment; ie. 1684145800 => Mon May 15 2023 10:16:40 GMT+0000. Recurring payments default to the closest half hour if startDate not supplied
amountyInt1500must > 0
currencyyString(3)USDfixed to: USD
loginNameyString(12)jack123merchant's login name
subjectnString(64)
bodynString(250)
channelyStringCC_CARD | CC_ACH
captureyStringY
notifyUrlyString(200)http://sample.com/notifymerchant endpoint for receiving recurring transaction notifications, must be http or https
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm
Response
namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyString
retDatayJSONif retCode=SUCCESS, order detailed info returned
retData contains order information:
namerequiredtypesampledescription
payOrderIdyStringSUCCESS or FAIL
mchIdyString
mchOrderNonString
originalOrderIdnStringoriginal pay order id for refund
amountyInt100in cents
currencyyStringCAD
payTypeyStringpay or refund
refundableyInt100in cents
statusyInt0,1,2,90 = pending order, 1 = unknown, 2 = success, 9 = fail
recurringIdyIntrecurring payment id this transaction belongs to ( 0 if non-recurring)
paySuccTimeyString2021-04-07 19:44:51
cardNumnString432567******2266
cardTypenStringA = Amex D = Discover M = Mastercard N = Non-co-branded debit card V = Visa (card payments only)
expiryDatenString
authNumyString
transNumyString
channelyStringCC_CARD | CC_ACH

Subscription Details

To check the metadata of a subscription

Endpoint

https://api.grubpay.io/v4/recurring

Method:

POST

Header

Content-Type: application/json;charset=UTF-8

Request
namerequiredtypesampledescription
mchIdyString10000701assigned by GrubPay
tokenyString(50)cf6e8f3f-c010-4b99-9a9f-32cf21ea7cb6reusable token
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm
Response
namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyString
retDatayJSONif retCode is SUCCESS, recurring payment(s) detailed info returned

retData contains order information:

namerequiredtypesampledescription
idyString
midyStringmerchant id
amountyInt100in cents
tokenyString(50)cf6e8f3f-c010-4b99-9a9f-32cf21ea7cb6reusable token
frequencyyString[w,2w,4w,m]current possible configurations are weekly, bi-weekly,every 4 weeks (28 days) or monthly (set day each given month)
start_dateyStringpayment start date in UTC time
last_paidyStringlast payment date in UTC time, defaults to "1970-01-01" if no payment has been made yet
last_paymentyStringPC20221123224002378248641620payorderid of last payment or of new order if no payment has been made yet
next_paymentyStringdate of next scheduled payment in UTC time

Cancel Subscription

To stop a subscription

Endpoint

https://api.grubpay.io/v4/cancel_recurring

Method:

POST

Header

Content-Type: application/json;charset=UTF-8

Request
namerequiredtypesampledescription
mchIdyString10000701assigned by GrubPay
recurringIdyInt12recurring payment id
loginNameyString(12)jack123merchant's login name
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm
Response
namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyStringSuccessfully deleted recurring #255
retDatayJSONif retCode is SUCCESS, recurring payment detailed info returned
Last Updated:
Contributors: Grant, Howard