Capture a payment

post/payments/{id}/capture

The POST /payments/{id}/capture call allows your platform to capture a payment (when auto_capture is set to false).

SecurityappIdAuth and appTokenAuth
Request
path Parameters
id
required
string [ 1 .. 255 ] characters

ID of the payment, generated by WePay when the payment is created.

header Parameters
Api-Version
required
string
Example: 3.0
Content-Type
required
stringapplication/json
Example: application/json
Unique-Key
string
Request Body schema: application/json
object or null

For Card Present, we allow adjusting the amounts to greater or less than the auth amount. For Card Not Present, we allow adjusting the amounts to less than the auth amount for delayed capture only.

object or null

Any custom data your platform chooses to attach to this resource. The custom data must be key-value pairs and not contain any personally identifiable information (PII) or payment card (PCI) data.

Responses
200
Response Schema: application/json
id
required
string or null

ID of the payment, generated by WePay when the payment is created.

resource
required
string

Helps organize information by identifying the resource type of the object data.

Value: Description
payments
path
required
string

The HTTP path of the resource. The path can be used to retrieve details about the resource and perform actions on it.

required
object or null

Details the owner resource and owner path.

create_time
required
integer <int64> >= 0

The UNIX timestamp for when the object was created.

status
required
string

Status of the payment. Possible values include: canceled completed, failed, pending.

Enum: Description
pending

This payment is processing, but is not yet included in the account's available or reserve balance. Find more information in the pending_reasons structure.

completed

This payment has finished processing, and is now available in either the account's available or reserved balance. Note: A payment can have a completed status and simultaneously have a refund or dispute issued against it.

… 2 more
amount
required
integer

Amount in the lowest denomination.

amount_refunded
required
integer
amount_disputed
required
integer
currency
required
string

ISO 4217 currency code. Possible values include: CAD & USD. Note: as of today, currency supports a single value.

Enum: Description
USD

United States Dollar

CAD

Canadian Dollar

… 1 more
required
object
initiated_by
required
string

Indicates who initiated a payment. Possible values include: customer, merchant, none.

Enum: Description
customer
merchant
… 1 more
reference_id
required
string or null [ 1 .. 255 ] characters

A custom reference ID for your platform to track the object. It can be any string.

capture_at
required
integer or null <int64> >= 0

For payments with a credit card payment method, designate the time at which this payment will capture using a UNIX epoch timestamp. The capture time cannot be more than 7 days in the future. Note that epoch timestamps use the UTC timezone.

authorization_code
required
string or null

Authorization code returned from the card issuer after a credit card payment is authorized

api_version
string
auto_capture
boolean

For payments with a credit card payment method, set to false to create a delayed-capture payment. Capture the payment within 7 days with the POST /payments/{id}/capture endpoint. Alternatively, cancel the payment with the POST /payments/{id}/cancel endpoint.

object or null

Any custom data your platform chooses to attach to this resource. The custom data must be key-value pairs and not contain any personally identifiable information (PII) or payment card (PCI) data.

object or null
fee_amount
integer

Specifies the fee amount your platform will collect from the payment. The amount should be in the lowest denomination. Note: Platforms leveraging the blended rate pricing model should use this parameter. This parameter is not applicable to platforms leveraging the Merchant IC+ pricing model.

object or null

The resource ID and path for the Order that your app created and associated with the payment.

Array of objects or null

Explains why this payment is pending and may contain an array of reasons.

object or null

Fetch this transaction record to account for the portion of this transaction which impact your application balance.

object or null

Fetch this transaction record to account for the merchant's portion of this transaction.

400

INVALID_PARAMS, PARAM_IS_MISSING, PARAM_VALUE_IS_TOO_SMALL_INCLUSIVE, FEE_EXCEEDS_PAYMENT_AMOUNT_THRESHOLD_PERCENTAGE

403

NOT_AUTHORIZED

500

UNEXPECTED_ERROR

Request samples
application/json
{
  • "amounts": {
    • "amount": 1500,
    • "currency": "USD",
    • "fee_amount": 150
    },
  • "custom_data": {
    • "foo": "bar"
    }
}
Response samples
application/json
{
  • "id": "00000000-0000-0000-0000-000000000",
  • "resource": "payments",
  • "path": "/payments/00000000-0000-0000-0000-000000000",
  • "owner": {
    • "id": "c3a62711-a604-40c5-b072-5e4434f969b3",
    • "resource": "accounts",
    • "path": "/accounts/c3a62711-a604-40c5-b072-5e4434f969b3"
    },
  • "create_time": 1611144982,
  • "capture_at": null,
  • "amount": 101,
  • "fee_amount": 0,
  • "auto_capture": false,
  • "status": "pending",
  • "currency": "USD",
  • "payment_method": {
    • "id": "f794e062-1f54-4e62-8f99-5db47469f8bd",
    • "resource": "payment_methods",
    • "path": "/payment_methods/f794e062-1f54-4e62-8f99-5db47469f8bd"
    },
  • "order": null,
  • "pending_reasons": [
    • {
      • "reason_code": "PROCESSING",
      • "reason_message": "Payment is being processed.",
      • "details": [
        • {
          • "detail_code": "processing",
          • "detail_message": "The payment currently under processing."
          }
        ]
      }
    ],
  • "failure_reason": null,
  • "txnr_app_fee": null,
  • "txnr_merchant": null,
  • "amount_refunded": 0,
  • "amount_disputed": 0,
  • "initiated_by": "none",
  • "reference_id": null,
  • "authorization_code": "00000",
  • "custom_data": null,
  • "api_version": "3.0"
}