payPaymentLink
Starts a payment for a payment link so the customer can settle its balance.
The code input field identifies the payment link and holds the same value as PaymentLink.code. Supply
either paymentMethod or paymentId; supplying neither resolves an error, and when both are supplied,
paymentId takes precedence and paymentMethod is ignored. paymentMethod takes a PaymentMethod.key from
PaymentLink.paymentMethods and creates a new payment over the link's PaymentLink.grandTotal. paymentId
connects a Payment.id that already exists to the link instead of creating one.
PayPaymentLinkPayload.redirectUrl is the URL you must send the customer to in order to complete the
payment at the provider. It resolves to null when you pass paymentId, because connecting an existing
payment does not open a session at the provider.
mutation PayPaymentLink($code: ID!, $paymentMethod: String) { payPaymentLink(input: {code: $code, paymentMethod: $paymentMethod}) { redirectUrl paymentLink { isPaid } } }mutation PayPaymentLink($code: ID!, $paymentMethod: String) { payPaymentLink(input: {code: $code, paymentMethod: $paymentMethod}) { redirectUrl paymentLink { isPaid } } }
PayPaymentLinkPayload.paymentLink resolves the link after the payment was connected. The link is not paid
at the moment this mutation resolves — PaymentLink.isPaid only becomes true once the connected payments
cover PaymentLink.grandTotal, so poll Query.paymentLink after the customer returns.
An unknown code resolves an error. A link that was canceled with cancelPaymentLink counts as
unknown here and can no longer be paid. If the provider refuses to open the payment session, the mutation
resolves an error too; offer the customer a different entry from PaymentLink.paymentMethods or let them
retry later.
Arguments
| Argument | Description | Type |
|---|---|---|
| input | PayPaymentLinkInput! |
Type
This field resolves to PayPaymentLinkPayload, which has the following fields:
| Field | Description | Type |
|---|---|---|
paymentLink | PaymentLink | |
redirectUrl | String |