Add Cash App Pay to Your Site (Grants) API
Afterpay Global API surface for retrieving Cash App Pay grants when adding Cash App Pay directly to a website through the Afterpay Global API.
Afterpay Global API surface for retrieving Cash App Pay grants when adding Cash App Pay directly to a website through the Afterpay Global API.
{"openapi":"3.1.0","info":{"title":"Add Cash App Pay to Your Site","version":"1.0.0"},"paths":{"/v2/grants/retrieve":{"post":{"operationId":"retrieve-grant","summary":"Retrieve Grant","description":"Retrieves a Cash App Pay customer grant by the ID of the customer that approved it and its own ID.","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","description":"Accept","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/retrieve-grant_Response_200"}}}},"401":{"description":"Unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Retrieve-grantRequestUnauthorizedError"}}}},"403":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Retrieve-grantRequestForbiddenError"}}}}},"requestBody":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetrieveGrantRequest"}}}}}},"/v2/grants/revoke":{"post":{"operationId":"revoke-grant","summary":"Revoke Grant","description":"Revokes a Cash App Pay customer grant by the ID of the customer that approved it and its own ID.","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","description":"Accept","required":false,"schema":{"type":"string","default":"application/json"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/revoke-grant_Response_200"}}}},"401":{"description":"Unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Revoke-grantRequestUnauthorizedError"}}}},"403":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Revoke-grantRequestForbiddenError"}}}}},"requestBody":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetrieveGrantRequest"}}}}}}},"servers":[{"url":"https://global-api-sandbox.afterpay.com","description":"Sandbox"},{"url":"https://global-api.afterpay.com","description":"Production"}],"webhooks":{"grant-status-updated":{"post":{"operationId":"grant-status-updated","summary":"Event: grant.status.updated","description":"**When is this event triggered?**\n\nThis event is triggered when a Cash App Pay grant status has been updated.","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":{"type":{"type":"string","description":"The type of event that occurred. `grant.status.updated` for this event."},"eventId":{"type":"string","description":"A unique identifier provided by Cash App for the event."},"grant":{"$ref":"#/components/schemas/CashGrant"},"timestamp":{"type":"string","description":"When the webhook event was created"}},"required":["type","eventId","grant","timestamp"]}}}}}}},"components":{"schemas":{"RetrieveGrantRequest":{"type":"object","properties":{"customerId":{"type":"string","description":"ID of the customer that approved the customer grant."},"grantId":{"type":"string","description":"ID of the customer grant to retrieve."}},"required":["customerId","grantId"],"title":"RetrieveGrantRequest"},"CashGrantIntent":{"type":"string","enum":["ON_FILE","ONE_TIME"],"description":"Either ON_FILE or ONE_TIME","title":"CashGrantIntent"},"CashGrantType":{"type":"string","enum":["CASHAPP"],"description":"CASHAPP for all Cash App Pay transactions","title":"CashGrantType"},"CashGrantDetailsStatus":{"type":"string","enum":["ACTIVE","EXPIRED","CONSUMED","REVOKED"],"description":"Describes whether or not this grant can be used to perform the action associated with it.\n\nIf `ACTIVE`, it can be used to perform the action.\n\nIf `EXPIRED`, it may no longer be used to perform the action due to the current time being past the \"expires_at\" time.\n\nIf `CONSUMED`, it was already redeemed to perform the action and cannot be used again.\n\nIf `REVOKED`, the customer or merchant explicitly unauthorized the grant, preventing it from being used to perform the action.\n","title":"CashGrantDetailsStatus"},"CashGrantDetailsCashapp":{"type":"object","properties":{"customerId":{"type":"string"},"cashtag":{"type":"string","description":"A publicly-accessible, unique identifier (username) for individuals and businesses using Cash App."}},"required":["customerId","cashtag"],"title":"CashGrantDetailsCashapp"},"CashGrantDetails":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/CashGrantDetailsStatus","description":"Describes whether or not this grant can be used to perform the action associated with it.\n\nIf `ACTIVE`, it can be used to perform the action.\n\nIf `EXPIRED`, it may no longer be used to perform the action due to the current time being past the \"expires_at\" time.\n\nIf `CONSUMED`, it was already redeemed to perform the action and cannot be used again.\n\nIf `REVOKED`, the customer or merchant explicitly unauthorized the grant, preventing it from being used to perform the action.\n"},"cashapp":{"$ref":"#/components/schemas/CashGrantDetailsCashapp"},"createdAt":{"type":"string","description":"When this grant was created, in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) format (UTC)."},"updatedAt":{"type":"string","description":"When this grant was last updated, in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) format (UTC)."},"expiresAt":{"type":"string","description":"If present, indicates when the grant's status will become EXPIRED, preventing a client from using it to create payments or refunds.\n\nThe timestamp is in the [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) format (UTC).\n"}},"required":["status","cashapp","createdAt","updatedAt","expiresAt"],"title":"CashGrantDetails"},"CashGrant":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for this grant issued by Cash App."},"intent":{"$ref":"#/components/schemas/CashGrantIntent","description":"Either ON_FILE or ONE_TIME"},"type":{"$ref":"#/components/schemas/CashGrantType","description":"CASHAPP for all Cash App Pay transactions"},"details":{"$ref":"#/components/schemas/CashGrantDetails"}},"required":["id","intent","type","details"],"description":"Describes a grant provided by Cash App.","title":"CashGrant"},"retrieve-grant_Response_200":{"type":"object","properties":{"grant":{"$ref":"#/components/schemas/CashGrant"}},"required":["grant"],"title":"retrieve-grant_Response_200"},"Retrieve-grantRequestUnauthorizedError":{"type":"object","properties":{"errorCode":{"type":"string"},"errorId":{"type":"string"},"message":{"type":"string"},"httpStatusCode":{"type":"integer"}},"title":"Retrieve-grantRequestUnauthorizedError"},"Retrieve-grantRequestForbiddenError":{"type":"object","properties":{"errorCode":{"type":"string"},"errorId":{"type":"string"},"message":{"type":"string"},"httpStatusCode":{"type":"integer"}},"title":"Retrieve-grantRequestForbiddenError"},"revoke-grant_Response_200":{"type":"object","properties":{"grant":{"$ref":"#/components/schemas/CashGrant"}},"required":["grant"],"title":"revoke-grant_Response_200"},"Revoke-grantRequestUnauthorizedError":{"type":"object","properties":{"errorCode":{"type":"string"},"errorId":{"type":"string"},"message":{"type":"string"},"httpStatusCode":{"type":"integer"}},"title":"Revoke-grantRequestUnauthorizedError"},"Revoke-grantRequestForbiddenError":{"type":"object","properties":{"errorCode":{"type":"string"},"errorId":{"type":"string"},"message":{"type":"string"},"httpStatusCode":{"type":"integer"}},"title":"Revoke-grantRequestForbiddenError"}},"securitySchemes":{"sec0":{"type":"http","scheme":"basic"}}}}