{"openapi":"3.1.0","info":{"title":"Billing Agreements (Deprecated)","version":"1.0.0"},"paths":{"/v2/billing-agreements/approvals":{"post":{"operationId":"start-billing-agreement-approval","summary":"Start Billing Agreement Approval Process","description":"Initiates the approval process for a new billing agreement.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"200":{"description":"The consumer approved the billing agreement","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementApprovalResponse"}}}},"401":{"description":"Authentication failed or insufficient permissions.\n\n| errorCode | Description |\n| --- | --- |\n| unauthorized | The API credentials are invalid or missing. |\n| insufficient_permissions | The merchant lacks the required 'merchant_api_v2/initiate' permission. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"403":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_authorised | Recurring payments are not enabled for this merchant. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"415":{"description":"Unsupported Media Type - Content-Type header is missing or invalid","content":{"application/json":{"schema":{"description":"Any type"}}}},"422":{"description":"| errorCode | Description |\n| --- | --- |\n| invalid_object | One or more required fields in the request body were missing or invalid. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The billing agreement approval request details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementApprovalRequest"}}}}}},"/v2/billing-agreements":{"post":{"operationId":"create-billing-agreement","summary":"Create Billing Agreement","description":"Creates a new billing agreement from an order token.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*\n","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"200":{"description":"Billing agreement created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementResponse"}}}},"403":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_authorised | Recurring payments are not enabled for this merchant. |\n| headless_billing_agreement_not_authorised | Headless flow is not enabled for this merchant. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"412":{"description":"| errorCode | Description |\n| --- | --- |\n| consumer_ineligible | Consumer not eligible |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"415":{"description":"Unsupported Media Type - Content-Type header is missing or invalid","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The request containing the details needed to create a billing agreement","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgreementRequest"}}}}}},"/v2/billing-agreements/alias":{"post":{"operationId":"alias-billing-agreement","summary":"Create Billing Agreement Alias","description":"Creates an alias for an existing billing agreement to help load payment schedule widget.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"200":{"description":"Alias created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementAliasResponse"}}}},"403":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_authorised | Recurring payments are not enabled for this merchant. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"415":{"description":"Unsupported Media Type - Content-Type header is missing or invalid","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The request containing the billing agreement token and optional duration","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementAliasRequest"}}}}}},"/v2/billing-agreements/cancel":{"put":{"operationId":"cancel-billing-agreement-alt","summary":"Cancel Billing Agreement (Alternative)","description":"Alternative endpoint to cancel a billing agreement using a request body instead of path parameter.\nFunctionally equivalent to DELETE /v2/billing-agreements/{token}.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"200":{"description":"Billing agreement cancelled successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementResponse"}}}},"403":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_authorised | Recurring payments are not enabled for this merchant. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"404":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_found | The specified billing agreement token was not found. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The request containing the billing agreement token to cancel","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelBillingAgreementRequest"}}}}}},"/v2/billing-agreements/offers":{"post":{"operationId":"retrieve-billing-agreement-offers","summary":"Retrieve Billing Agreement Offers","description":"Retrieves available offers for billing agreements based on amount and frequency.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"200":{"description":"Offers retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OffersResponse"}}}},"401":{"description":"Authentication failed or insufficient permissions.\n\n| errorCode | Description |\n| --- | --- |\n| unauthorized | The API credentials are invalid or missing. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"403":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_authorised | Recurring payments are not enabled for this merchant. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"422":{"description":"| errorCode | Description |\n| --- | --- |\n| invalid_object | One or more required fields in the request body were missing or invalid. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The request containing the amount and billing agreement token to check offers for","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OffersRequest"}}}}}},"/v2/billing-agreements/retrieve":{"post":{"operationId":"retrieve-billing-agreement","summary":"Retrieve Billing Agreement","description":"Alternative endpoint to retrieve billing agreement details using a request body instead of path parameter.\nFunctionally equivalent to GET /v2/billing-agreements/{token}.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Billing agreement details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementResponse"}}}},"403":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_authorised | Recurring payments are not enabled for this merchant. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"404":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_found | The specified billing agreement token was not found. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The request containing the billing agreement token to retrieve","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetBillingAgreementRequest"}}}}}},"/v2/billing-agreements/start":{"post":{"operationId":"start-billing-agreement-link","summary":"Start Billing Agreement Link Flow","description":"Initiates the headless billing agreement link flow process.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"201":{"description":"Link flow started successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkStartResponse"}}}},"404":{"description":"| errorCode | Description |\n| --- | --- |\n| not_found | Afterpay consumer account does not exist |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"412":{"description":"| errorCode | Description |\n| --- | --- |\n| invalid_state | Failed to send code |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"429":{"description":"| errorCode | Description |\n| --- | --- |\n| too_many_requests | Too many requests |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The request containing the details needed to start the billing agreement link flow","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkStartRequest"}}}}}},"/v2/billing-agreements/{token}":{"get":{"operationId":"get-billing-agreement","summary":"Get Billing Agreement Details","description":"Retrieves the details of a billing agreement using its token.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"token","in":"path","description":"The unique identifier token of the billing agreement to retrieve","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Billing agreement details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementResponse"}}}},"403":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_authorised | Recurring payments are not enabled for this merchant. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"404":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_found | The specified billing agreement token was not found. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}}},"delete":{"operationId":"cancel-billing-agreement","summary":"Cancel Billing Agreement","description":"Cancels an existing billing agreement using its token.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"token","in":"path","description":"The unique identifier token of the billing agreement to cancel","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Billing agreement cancelled successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingAgreementResponse"}}}},"403":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_authorised | Recurring payments are not enabled for this merchant. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"404":{"description":"| errorCode | Description |\n| --- | --- |\n| billing_agreement_not_found | The specified billing agreement token was not found. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}}}},"/v2/recurring-payments":{"post":{"operationId":"capture-full-recurring-payment","summary":"Capture Full Recurring Payment","description":"Creates and immediately captures a recurring payment using a billing agreement token.\nThis endpoint combines authorization and capture into a single step.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"201":{"description":"| Status | Description |\n| ----- | ----- |\n| `APPROVED` | If payment is approved by Afterpay, returns a Payment object in response, with a status of \"APPROVED\". |\n| `DECLINED` | If payment is declined by Afterpay, for example, if expired payment method, returns a Payment object in response, with a status of \"DECLINED\". Please advise the consumer to contact the Afterpay Customer Service team for more information. |\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"402":{"description":"If payment is declined by Afterpay, for example, if invalid card details were entered, returns a Payment object in response, with a `status` of \"DECLINED\" and a `paymentState` of \"AUTH_DECLINED\". Please advise the consumer to contact the Afterpay Customer Service team for more information.\n\nAs well, the following errorCodes are possible:\n| errorCode | Description |\n| --- | --- |\n| invalid_token | The checkout token is invalid, expired, or does not exist.\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"415":{"description":"Unsupported Media Type","content":{"application/json":{"schema":{"description":"Any type"}}}},"422":{"description":"| errorCode | Description |\n| --- | --- |\n| invalid_object | One or more required fields were missing or invalid. |\n| unsupported_payment_type | The amount is outside of the merchant's payment limits, as returned by Get Configuration. |\n| unsupported_currency | The amount is outside of the merchant's payment limits, as returned by Get Configuration. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The request containing the payment details to process","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurringPaymentRequest"}}}}}},"/v2/recurring-payments/auth":{"post":{"operationId":"auth","summary":"Authorize Recurring Payment","description":"Authorizes a recurring payment using a billing agreement token.\nThis endpoint performs authorization only, requiring a separate capture step.\n\n*Deprecated. For new integrations, see [Grants](https://afterpay.docs.buildwithfern.com/afterpay-online-developer/api-reference/reference/grants/start-grant-approval).*","tags":[""],"parameters":[{"name":"Authorization","in":"header","description":"Basic authentication","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}},{"name":"Accept","in":"header","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"201":{"description":"If the payment is approved by Afterpay, a Payment object is returned with a `status` of **APPROVED** and a `paymentState` of **AUTH_APPROVED**.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAuth"}}}},"402":{"description":"If payment is declined by Afterpay, for example, if invalid card details were entered, returns a Payment object in response, with a `status` of \"DECLINED\" and a `paymentState` of \"AUTH_DECLINED\". Please advise the consumer to contact the Afterpay Customer Service team for more information.\n\nAs well, the following errorCodes are possible:\n| errorCode | Description |\n| --- | --- |\n| invalid_token | The checkout token is invalid, expired, or does not exist.\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"412":{"description":"| errorCode | Description |\n| --- | --- |\n|npuf_eligibility_mismatch|Npuf eligibility mismatch|\n","content":{"application/json":{"schema":{"description":"Any type"}}}},"415":{"description":"Unsupported Media Type","content":{"application/json":{"schema":{"description":"Any type"}}}},"422":{"description":"| errorCode | Description |\n| --- | --- |\n| invalid_object | One or more required fields were missing or invalid. |\n| unsupported_payment_type | The amount is outside of the merchant's payment limits, as returned by Get Configuration. |\n| unsupported_currency | The amount is outside of the merchant's payment limits, as returned by Get Configuration. |\n","content":{"application/json":{"schema":{"description":"Any type"}}}}},"requestBody":{"description":"The request containing the payment details to authorize","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecurringPaymentRequest"}}}}}}},"servers":[{"url":"https://global-api-sandbox.afterpay.com","description":"Sandbox"},{"url":"https://global-api.afterpay.com","description":"Production"}],"webhooks":{"agreement-status-updated":{"post":{"operationId":"agreement-status-updated","summary":"Billing agreement status updated","description":"Webhook notification sent when a billing agreement's status changes","parameters":[{"name":"User-Agent","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook received successfully"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"agreementToken":{"type":"string","description":"Token identifying the billing agreement"},"status":{"$ref":"#/components/schemas/WebhooksAgreementStatusUpdatedPayloadContentApplicationJsonSchemaStatus","description":"Current status of the agreement"},"reasons":{"type":"array","items":{"type":"string"},"description":"List of reasons for the status update such as {PAYMENT_METHOD_EXPIRED, PENDING_RENEWAL, ACCOUNT_DEACTIVATED, USER_CANCELLED}"},"message":{"type":["string","null"],"description":"Optional message providing additional context"},"dateTime":{"type":"string","format":"date-time","description":"Timestamp of the status update"}},"required":["agreementToken","status","reasons","dateTime"]}}}}}}},"components":{"schemas":{"Consumer":{"type":"object","properties":{"email":{"type":"string","format":"email"},"givenNames":{"type":"string","description":"The consumer's first name"},"surname":{"type":"string","description":"The consumer's last name"},"phoneNumber":{"type":"string"}},"required":["email"],"description":"The consumer data model is used for gathering essential user information. It captures details such as the individual's first name, represented by `givenNames`, and their last name, captured under `surname`. In addition, it stores the user's contact number under `phoneNumber` and their email address under `email`. These fields collectively provide contact and identification details for a user.","title":"Consumer"},"BillingAgreementApprovalRequestMerchant":{"type":"object","properties":{"redirectConfirmUrl":{"type":"string"},"redirectCancelUrl":{"type":"string"},"popupOriginUrl":{"type":"string","description":"This property is optional when a `redirectConfirmURL` is provided."},"name":{"type":"string","description":"The merchant name displayed in the Afterpay approval flow."}},"required":["redirectConfirmUrl","redirectCancelUrl"],"title":"BillingAgreementApprovalRequestMerchant"},"AgreementApprovalType":{"type":"string","enum":["BILLING"],"description":"Agreement Type for approval.","title":"AgreementApprovalType"},"AgreementApproval":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/AgreementApprovalType","description":"Agreement Type for approval."},"merchantReference":{"type":["string","null"],"description":"A merchant-provided reference for the agreement."}},"required":["type"],"description":"Details about the agreement to be created.","title":"AgreementApproval"},"BillingAgreementApprovalRequest":{"type":"object","properties":{"consumer":{"$ref":"#/components/schemas/Consumer","description":"Consumer details for the billing agreement"},"merchant":{"$ref":"#/components/schemas/BillingAgreementApprovalRequestMerchant"},"merchantReference":{"type":"string","description":"Merchant's unique reference for this billing agreement"},"agreements":{"type":"array","items":{"$ref":"#/components/schemas/AgreementApproval"},"description":"Agreement type for approval (only single agreement is supported)"}},"required":["merchant"],"description":"Request body for initiating a billing agreement approval process","title":"BillingAgreementApprovalRequest"},"BillingAgreementApprovalResponse":{"type":"object","properties":{"token":{"type":"string","description":"Token identifying this billing agreement approval request"},"expires":{"type":"string","format":"date-time","description":"When this approval request expires"},"redirectCheckoutUrl":{"type":"string","format":"uri","description":"URL where the consumer should be redirected to complete approval"}},"required":["token","expires","redirectCheckoutUrl"],"description":"Response from initiating a billing agreement approval process","title":"BillingAgreementApprovalResponse"},"CreateAgreementRequest":{"type":"object","properties":{"requestId":{"type":"string","description":"A unique request ID, required for idempotent retries. It is recommended that the merchant generate a UUID for each unique request."},"token":{"type":"string","description":"The token returned from the create approval request."},"merchantReference":{"type":"string","description":"The reference order id that this payment corresponds to in the merchant's system.\nNote: Providing a new value will update any value previously set in the Create Checkout request."}},"required":["token"],"title":"CreateAgreementRequest"},"BillingAgreementResponseType":{"type":"string","enum":["BILLING"],"description":"Type of agreement","title":"BillingAgreementResponseType"},"BillingAgreementResponseStatus":{"type":"string","enum":["ACTIVE","CANCELLED","EXPIRED","PENDING_RENEWAL","PENDING_RENEWAL_EXPIRED"],"description":"Current status of the agreement","title":"BillingAgreementResponseStatus"},"AgreementEventResponseType":{"type":"string","enum":["CAPTURE","VOID"],"description":"Type of event","title":"AgreementEventResponseType"},"MoneyCurrency":{"type":"string","enum":["AUD","NZD","USD","CAD","GBP"],"title":"MoneyCurrency"},"Money":{"type":"object","properties":{"amount":{"type":"string","description":"The amount as a string representation of a decimal number, rounded to 2 decimal places."},"currency":{"$ref":"#/components/schemas/MoneyCurrency"}},"required":["amount","currency"],"description":"Object containing amount and currency","title":"Money"},"AgreementEventResponseStatus":{"type":"string","enum":["APPROVED","DECLINED"],"description":"Status of the agreement at the time of the event","title":"AgreementEventResponseStatus"},"AgreementEventResponse":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/AgreementEventResponseType","description":"Type of event"},"created":{"type":"string","format":"date-time","description":"Timestamp when the event occurred"},"amount":{"$ref":"#/components/schemas/Money","description":"Amount associated with the event"},"status":{"$ref":"#/components/schemas/AgreementEventResponseStatus","description":"Status of the agreement at the time of the event"},"merchantReference":{"type":["string","null"],"description":"Merchant's reference associated with this event"},"orderId":{"type":"number","format":"double","description":"Order ID associated with this event"}},"description":"Response type for agreement events","title":"AgreementEventResponse"},"BillingAgreementResponse":{"type":"object","properties":{"token":{"type":"string","description":"Unique token identifying the agreement"},"type":{"$ref":"#/components/schemas/BillingAgreementResponseType","description":"Type of agreement"},"status":{"$ref":"#/components/schemas/BillingAgreementResponseStatus","description":"Current status of the agreement"},"merchantReference":{"type":["string","null"],"description":"Merchant's reference for this agreement"},"created":{"type":"string","format":"date-time","description":"Timestamp when the agreement was created"},"cancelled":{"type":"string","format":"date-time","description":"If present, indicates when the agreement was cancelled"},"expires":{"type":"string","format":"date-time","description":"If present, indicates when the agreement's status will become EXPIRED, preventing a client from using it to create payments"},"events":{"type":"array","items":{"$ref":"#/components/schemas/AgreementEventResponse"},"description":"List of events associated with this agreement"},"requestId":{"type":["string","null"],"description":"Unique identifier for the request"},"consumerReference":{"type":["string","null"],"description":"Reference identifier for the consumer"},"email":{"type":["string","null"],"description":"Masked email address of the consumer"}},"required":["token","type","status","created"],"description":"Response type for billing agreements","title":"BillingAgreementResponse"},"BillingAgreementAliasRequest":{"type":"object","properties":{"token":{"type":"string","description":"Token of the billing agreement to create an alias for"},"duration":{"type":["string","null"],"format":"duration","description":"Duration of the billing agreement in ISO-8601 period format"}},"required":["token"],"description":"Request to create an alias for a billing agreement","title":"BillingAgreementAliasRequest"},"BillingAgreementAliasResponse":{"type":"object","properties":{"token":{"type":"string","description":"Token representing the billing agreement alias"},"expiry":{"type":"string","format":"date-time","description":"Timestamp when the alias token expires"}},"required":["token","expiry"],"description":"Response containing the payment schedule token and its expiry","title":"BillingAgreementAliasResponse"},"CancelBillingAgreementRequest":{"type":"object","properties":{"token":{"type":"string","description":"The billing agreement token to cancel"}},"required":["token"],"description":"Request to cancel a billing agreement","title":"CancelBillingAgreementRequest"},"OffersRequest":{"type":"object","properties":{"requestId":{"type":"string","description":"A unique identifier for this request"},"amount":{"$ref":"#/components/schemas/Money","description":"The amount to check offers for"},"token":{"type":"string","description":"The billing agreement token"}},"required":["requestId","amount","token"],"description":"Request to retrieve available billing agreement offers","title":"OffersRequest"},"OfferType":{"type":"string","enum":["PAY_IN_4"],"description":"Type of the offer","title":"OfferType"},"PaymentSchedule":{"type":"object","properties":{"amount":{"$ref":"#/components/schemas/Money","description":"Amount for this payment installment"},"dueDate":{"type":"string","format":"date","description":"Due date for this installment"}},"required":["amount","dueDate"],"description":"Represents a scheduled payment installment","title":"PaymentSchedule"},"ConsumerOffersNoPaymentUpfront":{"type":"object","properties":{"eligible":{"type":"boolean","description":"Indicates if the consumer is eligible for no payment upfront"},"eligibilityLimit":{"$ref":"#/components/schemas/Money","description":"The maximum amount eligible for no payment upfront"}},"required":["eligible","eligibilityLimit"],"description":"Information about the no payment upfront feature eligibility","title":"ConsumerOffersNoPaymentUpfront"},"ConsumerOffers":{"type":"object","properties":{"noPaymentUpfront":{"$ref":"#/components/schemas/ConsumerOffersNoPaymentUpfront","description":"Information about the no payment upfront feature eligibility"}},"description":"Consumer offers","title":"ConsumerOffers"},"Offer":{"type":"object","properties":{"type":{"$ref":"#/components/schemas/OfferType","description":"Type of the offer"},"merchantAmount":{"$ref":"#/components/schemas/Money","description":"Amount for the merchant"},"exchangeRate":{"type":"number","format":"double","description":"Exchange rate for cross-border transactions"},"amountDueToday":{"$ref":"#/components/schemas/Money","description":"Amount due for immediate payment"},"payments":{"type":"array","items":{"$ref":"#/components/schemas/PaymentSchedule"},"description":"List of scheduled payments"},"crossBorder":{"type":"boolean","description":"Indicates if this is a cross-border transaction"},"appliedPromotion":{"$ref":"#/components/schemas/Money","description":"Amount of promotion applied"},"consumer":{"$ref":"#/components/schemas/ConsumerOffers","description":"Consumer offer details"}},"description":"Represents an offer with payment details","title":"Offer"},"OffersResponse":{"type":"object","properties":{"consumerMaskedEmail":{"type":"string","description":"Masked email address of the consumer"},"consumerAmount":{"$ref":"#/components/schemas/Money","description":"Amount in consumer's currency"},"offers":{"type":"array","items":{"$ref":"#/components/schemas/Offer"},"description":"List of available offers details"}},"description":"Response containing available offers for the consumer","title":"OffersResponse"},"GetBillingAgreementRequest":{"type":"object","properties":{"token":{"type":"string","description":"The billing agreement token to retrieve"}},"required":["token"],"description":"Request to retrieve a billing agreement by token","title":"GetBillingAgreementRequest"},"LinkStartRequest":{"type":"object","properties":{"alias":{"type":"string","description":"Email or phone number associated with the consumer's afterpay account"},"requestId":{"type":"string","description":"A unique identifier for this request"}},"required":["alias","requestId"],"description":"Request to start a billing agreement link flow","title":"LinkStartRequest"},"LinkStartResponseDeliveryType":{"type":"string","enum":["SMS","EMAIL"],"description":"How the verification code was delivered to the consumer","title":"LinkStartResponseDeliveryType"},"LinkStartResponse":{"type":"object","properties":{"token":{"type":"string","description":"Token identifying the billing agreement to be created"},"requestId":{"type":"string","description":"The unique identifier from the request"},"expiresAt":{"type":"string","format":"date-time","description":"When this link attempt will expire"},"deliveryType":{"$ref":"#/components/schemas/LinkStartResponseDeliveryType","description":"How the verification code was delivered to the consumer"}},"required":["token","requestId","expiresAt","deliveryType"],"description":"Response containing the billing agreement link details","title":"LinkStartResponse"},"RecurringPaymentRequestPaymentMethodType":{"type":"string","enum":["BILLING_AGREEMENT"],"description":"The payment method type","title":"RecurringPaymentRequestPaymentMethodType"},"RecurringPaymentRequestPaymentMethod":{"type":"object","properties":{"token":{"type":"string","description":"The billing agreement token"},"type":{"$ref":"#/components/schemas/RecurringPaymentRequestPaymentMethodType","description":"The payment method type"}},"required":["token","type"],"title":"RecurringPaymentRequestPaymentMethod"},"ContactCountryCode":{"type":"string","enum":["AU","NZ","US","CA","GB"],"title":"ContactCountryCode"},"Contact":{"type":"object","properties":{"name":{"type":"string"},"line1":{"type":"string","description":"First line of the address"},"line2":{"type":"string","description":"Second line of the address "},"area1":{"type":"string","description":"- AU: Suburb\n- NZ: Town or City\n- UK: Postal Town\n- US: City\n- Canada: City"},"area2":{"type":"string","description":"- NZ: suburb\n- UK: village or local area."},"region":{"type":"string","description":"- AU: State \n- NZ: Region\n- UK: County\n- US: State\n- CA: Province or Territory"},"postcode":{"type":"string"},"countryCode":{"$ref":"#/components/schemas/ContactCountryCode"},"phoneNumber":{"type":"string","description":"The phone number, in [E.123](https://en.wikipedia.org/wiki/E.123) format."}},"required":["name","line1","area1","region","postcode","countryCode"],"description":"This data model is used for storing an individual's contact information. Mandatory fields such as **name**, **line1**, **area1**, **region**, **postcode**, and **countryCode** help in capturing vital information about a user's location. \n\nThe `line2` and `area2` fields provide additional space for extended addresses, while `phoneNumber` can be used to store the user's contact number.\n\n\n\n The `area1`, `area2` and `region` properties feature localized terminology based on country. Refer to the property descriptions for insights on each country's specific usage \n\n","title":"Contact"},"ShippingCourierPriority":{"type":"string","enum":["STANDARD","EXPRESS"],"title":"ShippingCourierPriority"},"Shipping-Courier":{"type":"object","properties":{"shippedAt":{"type":"string","format":"date-time"},"name":{"type":"string"},"tracking":{"type":"string"},"priority":{"$ref":"#/components/schemas/ShippingCourierPriority"}},"description":"Essential information for tracking a shipment. The `shippedAt` key represents the date and time when the item was shipped. This value follows the [ISO 8601 standard format](https://www.iso.org/iso-8601-date-and-time-format.html) for date and time representations.\n\nThe `name` field indicates the courier service employed to handle the shipment (e.g. FEDEX, UPS). For orders that are picked up in-store (also known as Buy-Online-Pickup-Instore), please use \"INSTORE_PICKUP\" as the `name` field value.\n\nThe `tracking` key represents a unique tracking number provided by the courier service to monitor the shipment's progress. It's a valuable tool for customers and businesses to track and trace their packages.\n\nThe `priority` field tracks the shipping speed or service level associated with the delivery. ","title":"Shipping-Courier"},"Item":{"type":"object","properties":{"name":{"type":"string"},"sku":{"type":"string"},"pageUrl":{"type":"string"},"imageUrl":{"type":"string"},"quantity":{"type":"integer"},"price":{"$ref":"#/components/schemas/Money"},"categories":{"type":"array","items":{"type":"array","items":{"type":"string"}}},"estimatedShipmentDate":{"type":"string","format":"date"},"preorder":{"type":"boolean","default":false}},"required":["name","quantity","price"],"description":"This data model is used to store crucial product details. The `price.amount` field represents the unit price of the individual item. The `quantity` field shows the number of units of the item. The `name` field denotes the name of the product, while `sku` holds the Stock Keeping Unit identifier. 100 is the maximum number of item objects in the items array.\n\n It is crucial that the `price.amount` represents the unit price of the individual item.\n **Never** populate the `price.amount` by multiplying the quantity by the unit cost. Always enter the price for a single unit to maintain data accuracy.\n\n","title":"Item"},"Discount":{"type":"object","properties":{"displayName":{"type":"string"},"amount":{"$ref":"#/components/schemas/Money"}},"description":"Discount applied to an order","title":"Discount"},"RecurringPaymentRequestMerchant":{"type":"object","properties":{"name":{"type":"string","description":"The merchant name to display"}},"title":"RecurringPaymentRequestMerchant"},"RecurringPaymentRequestEnrichmentsInitiationActor":{"type":"string","enum":["CUSTOMER","MERCHANT"],"description":"The actor initiating the transaction. Use MERCHANT when the customer is not present.","title":"RecurringPaymentRequestEnrichmentsInitiationActor"},"RecurringPaymentRequestEnrichmentsInitiation":{"type":"object","properties":{"actor":{"$ref":"#/components/schemas/RecurringPaymentRequestEnrichmentsInitiationActor","description":"The actor initiating the transaction. Use MERCHANT when the customer is not present."}},"description":"Describes who initiated the transaction","title":"RecurringPaymentRequestEnrichmentsInitiation"},"RecurringPaymentRequestEnrichments":{"type":"object","properties":{"initiation":{"$ref":"#/components/schemas/RecurringPaymentRequestEnrichmentsInitiation","description":"Describes who initiated the transaction"}},"title":"RecurringPaymentRequestEnrichments"},"RecurringPaymentRequest":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid","description":"A unique identifier for the request, used for idempotency"},"paymentMethod":{"$ref":"#/components/schemas/RecurringPaymentRequestPaymentMethod"},"amount":{"$ref":"#/components/schemas/Money","description":"The total amount of the payment"},"consumer":{"$ref":"#/components/schemas/Consumer"},"billing":{"$ref":"#/components/schemas/Contact"},"shipping":{"$ref":"#/components/schemas/Contact"},"courier":{"$ref":"#/components/schemas/Shipping-Courier"},"items":{"type":"array","items":{"$ref":"#/components/schemas/Item"}},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"}},"description":{"type":"string"},"merchant":{"$ref":"#/components/schemas/RecurringPaymentRequestMerchant"},"merchantReference":{"type":"string","description":"The reference/order ID in the merchant's system"},"shippingAmount":{"$ref":"#/components/schemas/Money","description":"The shipping cost amount"},"taxAmount":{"$ref":"#/components/schemas/Money","description":"The tax amount"},"custom":{"type":"object","additionalProperties":{"description":"Any type"},"description":"Custom key-value pairs for merchant use"},"paymentScheduleChecksum":{"type":"string","description":"Payment schedule validation checksum"},"enrichments":{"$ref":"#/components/schemas/RecurringPaymentRequestEnrichments"}},"required":["requestId","paymentMethod","amount"],"title":"RecurringPaymentRequest"},"PaymentStatus":{"type":"string","enum":["APPROVED","DECLINED"],"description":"represents the status of the order","title":"PaymentStatus"},"PaymentPaymentState":{"type":"string","enum":["AUTH_APPROVED","AUTH_DECLINED","PARTIALLY_CAPTURED","CAPTURED","CAPTURE_DECLINED","VOIDED"],"description":"is the current state for capturing payments","title":"PaymentPaymentState"},"Refund":{"type":"object","properties":{"requestId":{"type":"string","description":"Unique ID required for safe retries. Max length 64 (varchar)."},"amount":{"$ref":"#/components/schemas/Money"},"merchantReference":{"type":"string","description":"The merchant’s internal refund id/reference. This must be included along with the `requestId` to utilise idempotency. Max length 85 (varchar)."},"refundMerchantReference":{"type":"string","description":"A unique reference for the individual refund event. Max length 128 (varchar)."},"refundId":{"type":"string","description":"The unique, permanent, Afterpay-generated Refund ID."},"refundedAt":{"type":"string"}},"description":"To guarantee safe retries, the merchant should offer their refund ID or reference, aligning with their internal records\n\nUnique values for the `requestID` and `merchantReference` are required to guarantee safe retries. It is recommended that the merchant generates a UUID for each unique refund request.\n\nThe `refundMerchantReference` is a unique reference that when provided, will appear in the daily settlement file as \"Payment Event Id\". In most cases, this would hold the same value as the `merchantReference`.\n","title":"Refund"},"Order-Details":{"type":"object","properties":{"consumer":{"$ref":"#/components/schemas/Consumer"},"billing":{"$ref":"#/components/schemas/Contact"},"courier":{"$ref":"#/components/schemas/Shipping-Courier"},"items":{"type":"array","items":{"$ref":"#/components/schemas/Item"}},"discounts":{"type":"array","items":{"$ref":"#/components/schemas/Discount"}},"taxAmount":{"$ref":"#/components/schemas/Money"},"shippingAmount":{"$ref":"#/components/schemas/Money"}},"description":"This comprehensive schema is designed to store an entire transaction's detail, covering crucial aspects like consumer information, billing and shipping details, courier particulars, item list, discounts, tax, and shipping amount.","title":"Order-Details"},"PaymentEventType":{"type":"string","enum":["AUTH_APPROVED","AUTH_DECLINED","CAPTURED","CAPTURE_DECLINED","VOIDED","EXPIRED"],"title":"PaymentEventType"},"Payment-Event":{"type":"object","properties":{"id":{"type":"string"},"created":{"type":"string"},"expires":{"type":"string"},"type":{"$ref":"#/components/schemas/PaymentEventType"},"amount":{"$ref":"#/components/schemas/Money"},"paymentEventMerchantReference":{"type":"string"}},"description":"Each payment event has a unique ID, creation timestamp, and type (e.g., \"AUTH_APPROVED\", \"AUTH_DECLINED\"). For \"AUTH_APPROVED\" events, an expiration timestamp is provided. The \"payment event merchant reference\" field, which can be used for payment capture events","title":"Payment-Event"},"Payment":{"type":"object","properties":{"id":{"type":"string","description":"The unique, permanent, Afterpay generated Order ID."},"token":{"type":"string","description":"The token obtained from the checkout call"},"status":{"$ref":"#/components/schemas/PaymentStatus","description":"represents the status of the order"},"created":{"type":"string","description":" is the UTC timestamp of when the payment was completed."},"originalAmount":{"$ref":"#/components/schemas/Money"},"openToCaptureAmount":{"$ref":"#/components/schemas/Money"},"paymentState":{"$ref":"#/components/schemas/PaymentPaymentState","description":"is the current state for capturing payments"},"merchantReference":{"type":"string","description":"is the merchant's order id/reference that the payment corresponds to."},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}},"orderDetails":{"$ref":"#/components/schemas/Order-Details"},"events":{"type":"array","items":{"$ref":"#/components/schemas/Payment-Event"}}},"description":"Describes the schema for a (read-only) payment object","title":"Payment"},"PaymentAuthStatus":{"type":"string","enum":["APPROVED","DECLINED"],"description":"represents the status of the order","title":"PaymentAuthStatus"},"PaymentAuthPaymentState":{"type":"string","enum":["AUTH_APPROVED","AUTH_DECLINED","PARTIALLY_CAPTURED","CAPTURED","CAPTURE_DECLINED","VOIDED"],"description":"is the current state for capturing payments","title":"PaymentAuthPaymentState"},"PaymentAuth":{"type":"object","properties":{"id":{"type":"string","description":"The unique, permanent, Afterpay generated Order ID."},"token":{"type":"string","description":"The token obtained from the checkout call"},"status":{"$ref":"#/components/schemas/PaymentAuthStatus","description":"represents the status of the order"},"created":{"type":"string","description":" is the UTC timestamp of when the payment was completed."},"originalAmount":{"$ref":"#/components/schemas/Money"},"openToCaptureAmount":{"$ref":"#/components/schemas/Money"},"paymentState":{"$ref":"#/components/schemas/PaymentAuthPaymentState","description":"is the current state for capturing payments"},"merchantReference":{"type":"string","description":"is the merchant's order id/reference that the payment corresponds to."},"refunds":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}},"orderDetails":{"$ref":"#/components/schemas/Order-Details"},"events":{"type":"array","items":{"$ref":"#/components/schemas/Payment-Event"}}},"description":"Describes the schema for a (read-only) payment object","title":"PaymentAuth"},"WebhooksAgreementStatusUpdatedPayloadContentApplicationJsonSchemaStatus":{"type":"string","enum":["ACTIVE","INACTIVE","TERMINATED"],"description":"Current status of the agreement","title":"WebhooksAgreementStatusUpdatedPayloadContentApplicationJsonSchemaStatus"}},"securitySchemes":{"sec0":{"type":"http","scheme":"basic"}}}}