Payments

Payments are made by the user to Discord in exchange for first and third-party products and services.

Payment Clients

Payment clients are a concept used to prevent fraudulent transactions across Discord. When a client first attempts to make a payment, it generates a UUIDv4 identifier to be used as the purchase token. This token is then persisted by the client and sent along with all future payment requests. It is mandatory that all purchase requests include this token in the purchase_token field of the request body. The tokens expire after 60 days and must be regenerated.

If Discord detects suspicious activity from a payment client during a transaction, it sends a verification email to the user asking them to authorize the purchase. In the meantime, all purchase requests will fail with a 400 bad request and a 100056 JSON error code:

{
"message": "This client needs to be authorized for purchases. We've sent you an email. Click the link on the email and then retry the purchase.",
"code": 100056,
"payment_id": "1434311883015458937"
}

The verification email received will contain a link that redirects to the official Discord client with a verification token present in the URL's fragment (e.g. https://discord.com/authorize-payment#token=Wzg1Mjg5MjI5NzY2MTkwNjk5MywiN3NtVnNGYWlQNFBQTzIrREgya3JhUVJmZXFlclpvY3UvaFRwcVFBckw5Yz0iXQ.Y5ER6Q.IQhdQcfkK_eHLC16CcFZaYqRP_E). After receiving the token, clients can then send a request to the Verify Purchase Request endpoint to complete the authorization process. If the user has not received a link, clients can choose to resend it. Upon successful verification, the client will receive a User Payment Client Add Gateway event, which indicates that the purchase can be retried.

Payment Confirmation

Some purchases may require additional authentication before they can be completed. In such cases, the purchase request will fail with a 400 bad request and a 100057 JSON error code:

{
"message": "Confirmation required",
"code": 100047,
"payment_id": "1434311883015458937"
}

Depending on the payment gateway used, the error response may also contain a adyen_redirect_url field with a URL that the user must visit to complete the authentication process. Upon successful authentication, the purchase will be automatically confirmed. The client should not retry the purchase request.

Payment Object

Payment Structure
FieldTypeDescription
idsnowflakeThe ID of the payment
amountintegerThe amount of the payment
taxintegerThe amount of tax paid
tax_inclusivebooleanWhether the amount is inclusive of all taxes
currency 1stringThe lower-cased ISO 4217 currency code
amount_refundedintegerThe amount refunded from the payment
descriptionstringThe description of the payment
statusintegerThe status of payment
created_atISO8601 timestampWhen the payment was created
sku_id?snowflakeThe ID of the SKU the payment was for
sku_price?integerThe price of the SKU the payment was for
sku_subscription_plan_id?snowflakeThe ID of the subscription plan the payment was for
payment_gateway?integerThe payment gateway the payment was made with
payment_gateway_payment_id?stringThe ID of the payment on the payment gateway
has_invoice_url?booleanWhether the payment has a downloadable invoice
has_refund_invoice_urls?booleanWhether the payment has downloadable refund invoices
downloadable_invoice?stringThe URL to download the VAT invoice for this payment
downloadable_refund_invoices?array[string]The URLs to download VAT credit notices for refunds on this payment
refund_disqualification_reasons?array[integer]The reasons why the payment cannot be refunded
flagsintegerThe payment's flags
sku?SKU objectThe SKU the payment was for
payment_source?payment source objectThe payment source the payment was made with
subscription?partial subscription objectThe subscription the payment was for
metadatapayment metadata objectThe payment metadata

1 The value can be discord_orb to represent payment via virtual currency.

Payment Metadata Structure
FieldTypeDescription
billing_error_code?integerThe JSON error code that occurred during the payment
Payment Status
ValueNameDescription
0PENDINGPayment is pending
1COMPLETEDPayment has gone through
2FAILEDPayment has failed
3REVERSEDPayment has been reversed
4REFUNDEDPayment has been refunded
5CANCELEDPayment has been canceled
Refund Disqualification Reason
ValueNameDescription
0OTHERPurchase is disqualified from a refund due to other reasons
1ALREADY_REFUNDEDPurchase is disqualified from a refund because it has already been refunded
2NOT_USER_REFUNDABLE_TYPEPurchase is disqualified from a refund because it is not a user-refundable type
3PAST_REFUNDABLE_DATEPurchase is disqualified from a refund because it is past the refundable date
4ENTITLEMENT_ALREADY_CONSUMEDPurchase is disqualified from a refund because the purchased entitlement has already been consumed
5ALREADY_REFUNDED_PREMIUMPurchase is disqualified from a refund because the user has already refunded a premium subscription purchase
6ALREADY_REFUNDED_PREMIUM_GUILDPurchase is disqualified from a refund because the user has already refunded a premium guild subscription purchase
Payment Flags
ValueNameDescription
1 << 0GIFTPayment is for a gift
1 << 2USER_REFUNDEDPayment has been self-refunded
1 << 3PREORDERPayment is a preorder
1 << 4PENDINGAutomatic payment is pending manual authorization by the user
1 << 5TEMPORARY_AUTHORIZATIONPayment is a temporary authorization

Invoice Object

Invoice Structure
FieldTypeDescription
idsnowflakeThe ID of the invoice
status?integerThe status of the invoice
currencystringThe lower-cased ISO 4217 currency code the invoice is in
subtotalintegerThe subtotal of the invoice
taxintegerThe tax applied to the invoice
totalintegerThe total of the invoice
tax_inclusivebooleanWhether the subtotal is inclusive of all taxes
itemsarray[invoice item object]The items in the invoice
subscription_period_start?ISO8601 timestampWhen the current billing period started
subscription_period_end?ISO8601 timestampWhen the current billing period ends
applied_discount_ids?array[snowflake]The IDs of the discounts applied to the invoice
applied_user_discounts?map[snowflake, ?ISO8601 timestamp]The user discount offers applied to the invoice and their expiration dates
orbs_reward?integerThe amount of Orbs the invoice granted
Invoice Status
ValueNameDescription
1OPENInvoice is open
2PAIDInvoice is paid
3VOIDInvoice is void
4UNCOLLECTIBLEInvoice is uncollectible
Invoice Item Structure
FieldTypeDescription
idsnowflakeThe ID of the invoice item
quantityintegerHow many of the item have been/are being purchased
amountintegerThe price of the item (includes discounts)
prorationbooleanWhether the item is prorated
subscription_plan_id?snowflakeThe ID of the subscription plan the item represents
subscription_plan_price 1?integerThe price of the subscription plan the item represents
discountsarray[invoice discount object]The discounts applied to the item
sku_id?snowflakeThe ID of the SKU
unit_price 1?unit priceThe unit price of the item
tenant_metadata?map[string, any]Tenant metadata for the invoice item

1 Does not include discounts.

Invoice Discount Structure
FieldTypeDescription
typeintegerThe type of discount
amountintegerHow much the discount is
Invoice Discount Type
ValueNameDescription
1SUBSCRIPTION_PLANDiscount is from an existing subscription plan’s remaining credit
2ENTITLEMENTDiscount is from an applied entitlement
3PREMIUM_LEGACY_UPGRADE_PROMOTIONDiscount is from a legacy premium plan promotion discount
4PREMIUM_TRIALDiscount is from a premium trial
5DEFAULTDiscount is a default discount
Unit Price Structure
FieldTypeDescription
currencystringThe lower-cased ISO 4217 currency code
amountintegerThe price amount in the smallest currency unit
exponentintegerThe exponent to convert the amount to the displayed currency unit

Endpoints

Verify Purchase Request

POST/billing/verify-purchase-request

Verifies and authorizes a payment client for purchases. Returns a 204 empty response on success.

JSON Params
FieldTypeDescription
tokenstringThe verification token from the email link

Resend Payment Verification Email

POST/store/email/resend-payment-verification

Resends the payment verification email to the user. Returns an empty object on success.

JSON Params
FieldTypeDescription
purchase_tokenstringThe purchase token of the payment client (max 1024 characters)

Get Payments

GET/users/@me/billing/payments

Returns a list of payment objects that the current user has made.

FieldTypeDescription
limitintegerMax number of payments to return (1-100, default unlimited)
before?snowflakeGet payments before this payment ID
after?snowflakeGet payments after this payment ID

Get Payment

GET/users/@me/billing/payments/{payment.id}

Returns a payment object for the given payment ID.

Void Payment

POST/users/@me/billing/payments/{payment.id}/void

Voids the pending payment. Returns a 204 empty response on success. Fires Payment Update Gateway event.

Get Payment Invoice Breakdown

GET/users/@me/billing/invoice/breakdown

Returns URLs to download VAT invoices for the given payment ID.

Query Params
FieldTypeDescription
payment_idsnowflakeThe ID of the payment to get invoices
Response Body
FieldTypeDescription
invoiceLink?stringThe URL to download the invoice
refundInvoiceLinks?array[string]The URLs to download refund invoices