REST API – Payments Route

Table of Contents

The payments route allows you to interact with the Restrict Content Pro payments database to retrieve payments, add new ones, update existing payments, and delete payments.

Get payments

GET /wp-json/rcp/{version}/payments/

Required parameters:

  • None.

Optional parameters:

  • user_id (int) – Get payments made by a specific user ID.
  • subscription (string) – Get payments for a specific subscription name.
  • status (string) – The status of payments to retrieve.
    • complete
    • pending
    • failed
    • refunded
    • abandoned
  • number (int) – The total of payments to retrieve per page.
  • offset (int) – The number of payments to skip (for pagination purposes).
  • orderby (string) – The field on which to order the payments returned
    • id
    • user_id
    • subscription
    • subscription_key
    • status
    • date
  • order (string) – The direction which to sort payments.
    • ASCDESC

Get specific payment

GET /wp-json/rcp/{version}/payments/{payment_id}

Required parameters:

  • id – The payment ID to retrieve. Can be passed in the URL or as part of the body.

Optional parameters:

  • None.

New payment

POST /wp-json/rcp/{version}/payments/new

Required parameters:

  • user_id (int) – The member account ID the payment belongs to.
  • amount (float) – The total amount of the payment.
  • subscription (string) – The name of the membership level the payment was recorded for.

Optional parameters:

  • status (string) – The status of the payment.
    • complete
    • pending
    • failed
    • refunded
    • abandoned
  • object_id (int) – The ID number of the membership level the payment was recorded for.
  • object_type (string) – The type of object the object_id corresponds to.
  • subscription_key (string) – The subscription key of the level the payment was recorded for.
  • transaction_id (string) – The transaction ID from the merchant processor of the payment.
  • date (string) – The date the payment was processed in MySQL format.
  • payment_type (string) – A descriptor of the payment type. Example: Credit CardPayPal, or Credit Card One Time.
  • subtotal (float) – The payment subtotal.
  • credits (float) – The amount of credits applied to the payment.
  • fees (float) – The amount of fees applied to the payment.
  • discount_amount (float) – The discount amount applied to the payment.
  • discount_code (string) – The discount code used for this payment.
  • gateway (string) – The slug of the gateway that was used for this payment.

Update payment

POST /wp-json/rcp/{version}/payments/update/{payment_id}

Required parameters:

  • id (int) – The ID of the payment to update. Can be passed in the URL or as part of the body.

Optional parameters:

  • user_id (int) – The member account ID the payment belongs to.
  • amount (float) – The total amount of the payment.
  • subscription (string) – The name of the subscription level the payment was recorded for.
  • status (string) – The status of the payment.
    • complete
    • pending
    • failed
    • refunded
    • abandoned
  • object_id (int) – The ID number of the membership level the payment was recorded for.
  • object_type (string) – The type of object the object_id corresponds to.
  • subscription_key (string) – The subscription key of the level the payment was recorded for.
  • transaction_id (string) – The transaction ID from the merchant processor of the payment.
  • date (string) – The date the payment was processed in MySQL format.
  • payment_type (string) – A descriptor of the payment type. Example: Credit CardPayPal, or Credit Card One Time.
  • subtotal (float) – The payment subtotal.
  • credits (float) – The amount of credits applied to the payment.
  • fees (float) – The amount of fees applied to the payment.
  • discount_amount (float) – The discount amount applied to the payment.
  • discount_code (string) – The discount code used for this payment.
  • gateway (string) – The slug of the gateway that was used for this payment.

Delete payment

DELETE /wp-json/rcp/{version}/payments/delete

Required parameters:

  • id (int) – The ID of the payment to delete

Optional parameters:

  • None.

Have more questions? Submit a request

Have more questions?

Submit a request