Retrieve a Payment Intent
Retrieve a Payment Intent resource by ID.
A Payment Intent can be retrieved from the client side using a public API key when the client_secret is passed via query string. Getting the payment intent from the client side is normally done through our client-side library called PayRexJS.
If you will retrieve the payment intent from our backend, you can use the secret API key wihout passing the client secret.
Fetching the Payment Intent using the secret API key from the backend returns more sensitive information than retrieving it from the client side. The attributes returned from the client side through public API are the information needed to complete a payment.
Endpoint
GET /payment_intents/:id
Sample code
- curl
- Node
- PHP
- Python
- Ruby
curl --location 'https://api.payrexhq.com/payment_intents/<ID of a payment intent resource>' \
-u replace_with_secret_api_key:
const client = require('payrex-node')('insert your PayRex Secret API key.');
const paymentIntent = await client.paymentIntents.retrieve('<ID of a payment intent resource>');
$client = new \Payrex\PayrexClient('insert your PayRex Secret API key.');
$paymentIntent = $client->paymentIntents->retrieve('<ID of a payment intent resource>');
from payrex import Client as PayrexClient
client = PayrexClient('insert your PayRex Secret API key.')
payment_intent = client.payment_intents.retrieve('<ID of a payment intent resource>')
client = Payrex::Client.new("insert your PayRex Secret API key.")
payment_intent = client.payment_intents.retrieve("<ID of a payment intent resource>")
Parameters
client_secret REQUIRED IF YOU USE A PUBLIC KEY.
The client secret of the PaymentIntent. This attribute is required if you authenticate with the endpoint using your public key. This endpoint is used by PayRexJS using the public key.
Returns
Returns a Payment Intent resource.