Client-side configuration

Here is an example that demonstrates client integration and can be used for any Server integration for creating user approval.

  1. javascript
fundingSource: paypal.FUNDING.PAYPAL,
createOrder: function () {
  return paypalCheckoutInstance.createPayment({
    flow: 'checkout', // Required
    amount: 10.00, // Required
    currency: 'USD', // Required, must match the currency passed in with loadPayPalSDK
    intent: 'capture', // Must match the intent passed in with loadPayPalSDK
    enableShippingAddress: true,
    shippingAddressEditable: false,
    shippingAddressOverride: {…},
    lineItems: [{
      quantity: 1,
      unitAmount: 10.00,
      name: "item name",
      kind: "debit",
      upcCode: "012345678912",
      upcType: "UPC-A", //New field
      url: "https://example.com", //New field
      imageUrl: "https://example.com/product1.jpeg", //New field
    }]
  });
},
  1. swift
let request = BTPayPalCheckoutRequest(amount: "1.00")
let lineItem = BTPayPalLineItem(quantity: "1", unitAmount: "1", name: "item", kind: .debit)
lineItem.imageURL = URL(string: "http://example/image.jpg")
  1. kotlin
val request = PayPalCheckoutRequest(
    amount = "12.34",
    hasUserLocationConsent = true
)

val item = PayPalLineItem(
    kind = PayPalLineItemKind.DEBIT,
    name = "An Item",
    quantity = "1",
    unitAmount = "1",
    imageUrl = "http://example.com/image.jpg",
    upcCode = "upc-code",
    upcType = PayPalLineItemUpcType.UPC_TYPE_2
)

request.lineItems = listOf(item)
Next Page: Server-side configuration →