Additional Options
- Amount: Allows you to update the amount of the shopping cart that was approved by the Buyer. Note the currency can't be updated at this step. It has to match the currency passed at the time of tokenizing the payment.
- Order ID: Use this field to pass additional information about the PayPal Order. When it comes to the Order itself, the Order ID stays on Braintree. However, in the case of the PayPal Order's captures, Order IDs are received by the PayPal API and are recorded under 'invoice number' on PayPal's side. These invoice numbers can be used for lookup in the PayPal Console for captures. PayPal invoice numbers must be unique in your PayPal business account.
- Custom field: Use this field to pass information directly to PayPal via the API for your own tracking purposes. Customers do not see this value, but you can see it in reports from your PayPal console.
- Description: Description of the transaction that is displayed to customers in PayPal email receipts. Max 127 characters.
- Shipping: Shipping destination address input.
Examples
Create a new customer with a payment method
If you do not already have a record for this customer in your Vault, you can create a new customer
with a payment method using
Customer: Create
with the
PaymentMethodNonce
parameter.
- C#
var request = new CustomerRequest {
FirstName = "Fred",
LastName = "Jones",
PaymentMethodNonce = NonceFromTheClient,
Options = new CustomerOptionsRequest {
OptionsPayPal = new CustomerOptionsPayPalRequest {
Amount = 10.00M,
OrderId = "PayPal_Invoice_Number",
CustomField = "My_Custom_Field",
Description = "My_Description",
Shipping = new AddressRequest {
FirstName = "Fred",
LastName = "Jones",
Locality = "San Jose",
PostalCode = "95131",
StreetAddress = "111 Main St",
Region = "CA",
CountryCodeAlpha2 = "US"
}
}
}
};
Result<customer> result = gateway.Customer.Create(request);
bool success = result.IsSuccess(); // true
Customer customer = result.Target;
string customerId = customer.Id; // e.g. 160923
string cardToken = customer.PaymentMethods[0].Token; // e.g. f28w
Update an existing customer with a payment method
If the customer already exists in your Vault, you can add a new payment method to that customer
using Customer: Update
with the
PaymentMethodNonce
parameter.
- C#
var request = new CustomerRequest {
PaymentMethodNonce = NonceFromTheClient,
Options = new CustomerOptionsRequest {
OptionsPayPal = new CustomerOptionsPayPalRequest {
Amount = 10.00M,
OrderId = "PayPal_Invoice_Number",
CustomField = "My_Custom_Field",
Description = "My_Description",
Shipping = new AddressRequest {
FirstName = "Fred",
LastName = "Jones",
Locality = "San Jose",
PostalCode = "95131",
StreetAddress = "111 Main St",
Region = "CA",
CountryCodeAlpha2 = "US"
}
}
}
};
Result<customer> updateResult = gateway.Customer.Update("the_customer_id", request);
bool success = result.IsSuccess(); // true
NotFoundException
. Alternatively, you can use
Payment Method: Create
to accomplish the
same thing as above.