REST API - Payments Route

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.
    • ASC, DESC

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 subscription level the payment was recorded for.

Optional parameters:

  • status (string) - The status of the payment.
    • complete
    • pending
    • failed
    • refunded
    • abandoned
  • 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 Card, PayPal, or Credit Card One Time.

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
  • 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 Card, PayPal, or Credit Card One Time.

Delete payment

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

Required parameters:

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

Optional parameters:

  • None.