An order represents a payment between two or more parties. Use the Orders API to create, update, retrieve, authorize, and capture orders., Call the Payments API to authorize payments, capture authorized payments, refund payments that have already been captured, and show payment information. Use the Payments API in conjunction with the Orders API. For more information, see the PayPal Checkout Overview., The Payment Method Tokens API saves payment methods so payers don't have to enter details for future transactions. Payers can check out faster or pay without being present after they agree to save a payment method.
The API associates a payment method with a temporary setup token. Pass the setup token to the API to exchange the setup token for a permanent token.
The permanent token represents a payment method that's saved to the vault. This token can be used repeatedly for checkout or recurring transactions such as subscriptions.
The Payment Method Tokens API is available in the US only.
Find out more here: https://developer.paypal.com/docs/api/orders/v2/
Install the SDK by adding the following dependency in your project's pom.xml file:
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>paypal-server-sdk</artifactId>
<version>0.5.1</version>
</dependency>
You can also view the package at: https://central.sonatype.com/artifact/com.paypal.sdk/paypal-server-sdk/0.5.1
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
Parameter | Type | Description |
---|---|---|
environment |
Environment |
The API environment. Default: Environment.SANDBOX |
httpClientConfig |
Consumer<HttpClientConfiguration.Builder> |
Set up Http Client Configuration instance. |
loggingConfig |
Consumer<ApiLoggingConfiguration.Builder> |
Set up Logging Configuration instance. |
clientCredentialsAuth |
ClientCredentialsAuth |
The Credentials Setter for OAuth 2 Client Credentials Grant |
The API client can be initialized as follows:
PaypalServerSDKClient client = new PaypalServerSDKClient.Builder()
.loggingConfig(builder -> builder
.level(Level.DEBUG)
.requestConfig(logConfigBuilder -> logConfigBuilder.body(true))
.responseConfig(logConfigBuilder -> logConfigBuilder.headers(true)))
.httpClientConfig(configBuilder -> configBuilder
.timeout(0))
.clientCredentialsAuth(new ClientCredentialsAuthModel.Builder(
"OAuthClientId",
"OAuthClientSecret"
)
.build())
.environment(Environment.SANDBOX)
.build();
API calls return an ApiResponse
object that includes the following fields:
Field | Description |
---|---|
getStatusCode |
Status code of the HTTP response |
getHeaders |
Headers of the HTTP response as a Hash |
getResult |
The deserialized body of the HTTP response as a String |
The SDK can be configured to use a different environment for making API calls. Available environments are:
Name | Description |
---|---|
Production | PayPal Live Environment |
Sandbox | Default PayPal Sandbox Environment |
This API uses the following authentication schemes.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。