On this page
No Headings
Payer confirms their intent to pay for the the Order with the given payment source.
Oauth2 https://uri.paypal.com/services/payments/payment, https://uri.paypal.com/services/payments/initiatepayment, https://uri.paypal.com/services/payments/orders/client_sdk_orders_apiOauth 2.0 authentication
In: header
Scope: https://uri.paypal.com/services/payments/payment, https://uri.paypal.com/services/payments/initiatepayment, https://uri.paypal.com/services/payments/orders/client_sdk_orders_api
The ID of the order for which the payer confirms their intent to pay.
^[A-Z0-9]+$1 <= length <= 36A GUID value originating from Fraudnet and Dyson passed from external API clients via HTTP header. The value is used by Risk decisions to correlate calls which, in turn, might result in lower decline rates..
^[A-Za-z0-9-{}(),]*$1 <= length <= 68Holds authorization information for external API calls.
^.*$1 <= length <= 16000Header for an API client-provided JWT assertion that identifies the merchant. Establishing the consent to act-on-behalf of a merchant is a prerequisite for using this header.
^.*$1 <= length <= 10000The preferred server response upon successful completion of the request. Value is:return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links.return=representation. The server returns a complete resource representation, including the current state of the resource.
"return=minimal"^[a-zA-Z=]*$1 <= length <= 25application/json
TypeScript Definitions
Use the request body type in TypeScript.
application/json
application/json
application/json
application/json
application/json
application/json
Request samples
using Microsoft.Extensions.Logging;
using PaypalServerSdk.Standard;
using PaypalServerSdk.Standard.Authentication;
using PaypalServerSdk.Standard.Controllers;
using PaypalServerSdk.Standard.Exceptions;
using PaypalServerSdk.Standard.Http.Response;
using PaypalServerSdk.Standard.Models;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace TestConsoleProject
{
public class Program
{
public static async Task Main()
{
PaypalServerSdkClient client = new PaypalServerSdkClient.Builder()
.ClientCredentialsAuth(
new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.Build())
.Environment(PaypalServerSdk.Standard.Environment.Sandbox)
.LoggingConfig(config => config
.LogLevel(LogLevel.Information)
.RequestConfig(reqConfig => reqConfig.Body(true))
.ResponseConfig(respConfig => respConfig.Headers(true))
)
.Build();
OrdersController ordersController = client.OrdersController;
// Request body for this sample:
// {
// "payment_source": {
// "paypal": {
// "name": {
// "given_name": "John",
// "surname": "Doe"
// },
// "email_address": "customer@example.com",
// "experience_context": {
// "payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
// "brand_name": "EXAMPLE INC",
// "locale": "en-US",
// "landing_page": "LOGIN",
// "shipping_preference": "SET_PROVIDED_ADDRESS",
// "user_action": "PAY_NOW",
// "return_url": "https://example.com/returnUrl",
// "cancel_url": "https://example.com/cancelUrl"
// }
// }
// }
// }
ConfirmOrderInput confirmOrderInput = new ConfirmOrderInput
{
Id = "5O190127TN364715T",
Prefer = "return=minimal",
};
try
{
ApiResponse<Order> result = await ordersController.ConfirmOrderAsync(confirmOrderInput);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
}
}
}Request Body
{
"payment_source": {
"paypal": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com",
"experience_context": {
"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
"brand_name": "EXAMPLE INC",
"locale": "en-US",
"landing_page": "LOGIN",
"shipping_preference": "SET_PROVIDED_ADDRESS",
"user_action": "PAY_NOW",
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}
}
}Response samples
{
"id": "5O190127TN364715T",
"payment_source": {
"paypal": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com"
}
},
"payer": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com"
},
"links": [
{
"href": "https://api.paypal.com/v2/checkout/orders/5O190127TN364715T",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T",
"rel": "payer-action",
"method": "GET"
}
]
}{
"name": "INVALID_REQUEST",
"details": [
{
"field": "/payment_source",
"issue": "MISSING_REQUIRED_PARAMETER",
"description": "A required field or parameter is missing.",
"location": "body"
}
],
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "90957fca61718",
"links": [
{
"href": "https://developer.paypal.com/api/orders/v2/#error-MISSING_REQUIRED_PARAMETER",
"rel": "information_link",
"method": "GET"
}
]
}{
"name": "NOT_AUTHORIZED",
"message": "Authorization failed due to insufficient permissions.",
"debug_id": "9ecb6d8e2e112",
"details": [
{
"issue": "PERMISSION_DENIED",
"description": "You do not have permission to access or perform operations on this resource."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/overview/#error",
"rel": "information_link"
}
]
}{
"name": "RESOURCE_NOT_FOUND",
"message": "The specified resource does not exist.",
"debug_id": "ccb6f410b107f",
"details": [
{
"issue": "INVALID_RESOURCE_ID",
"description": "Specified resource ID does not exist. Please check the resource ID and try again."
}
],
"links": [
{
"href": "https://developer.paypal.com/docs/api/payments/v2/#error-INVALID_RESOURCE_ID",
"rel": "information_link"
}
]
}{
"name": "UNPROCESSABLE_ENTITY",
"details": [
{
"field": "/payment_source/paypal/vault_id",
"location": "body",
"issue": "MISMATCHED_VAULT_ID_TO_PAYMENT_SOURCE",
"description": "The vault_id does not match the payment_source provided. Please verify that the vault_id token used refers to the matching payment_source and try again. For example, a PayPal token cannot be passed in the vault_id field in the payment_source.card object."
}
],
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "90957fca61718",
"links": [
{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-MISMATCHED_VAULT_ID_TO_PAYMENT_SOURCE",
"rel": "information_link",
"method": "GET"
}
]
}{
"name": "INTERNAL_SERVER_ERROR",
"message": "An internal server error has occurred.",
"debug_id": "1a5b2a886ea32",
"links": [
{
"href": "https://developer.paypal.com/docs/api/payments/v2/#error-INTERNAL_SERVER_ERROR",
"rel": "information_link"
}
]
}The payment source definition.
Customizes the payer confirmation experience.