--- title: "Zip Component" description: "Add Zip to your Web Components integration." url: "https://docs.adyen.com/payment-methods/zip/web-component" source_url: "https://docs.adyen.com/payment-methods/zip/web-component.md" canonical: "https://docs.adyen.com/payment-methods/zip/web-component" last_modified: "2019-09-06T17:19:00+02:00" language: "en" --- # Zip Component Add Zip to your Web Components integration. [View source](/payment-methods/zip/web-component.md) This page explains how to add Zip to your existing Web Components integration. ## Requirements Select the [server-side flow](/online-payments/build-your-integration) that your integration uses: ### Tab: Sessions flow | Requirement | Description | | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built a Sessions flow [Web Components integration](/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Components). | | **Setup steps** | Before you begin, [add Zip in your Customer Area](/payment-methods/add-payment-methods). | ### Tab: Advanced flow | Requirement | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Integration type** | Make sure that you have built an Advanced flow [Web Components integration](/online-payments/build-your-integration/advanced-flow?platform=Web\&integration=Components). | | **Setup steps** | Before you begin, [add Zip in your Customer Area](/payment-methods/add-payment-methods). | ## API reference Select which endpoint you are using: ### Tab: `/sessions` This is the default with [Components v5.0.0](/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Components) or later. | Parameter name | Required | Description | | ------------------------------------------------------------------------------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [shopperName](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperName) | | Shopper's first name and last name. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-shopperEmail) | | The shopper's email address. | | [dateOfBirth](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-dateOfBirth) | | The shopper's date of birth. | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-telephoneNumber) | | The shopper's phone number. | | [billingAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-billingAddress) | | The address where the invoice should be sent. | | [deliveryAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-deliveryAddress) | | The address where the purchased goods should be delivered. | | [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions#request-lineItems) | | Price and product information about the purchased items. You can optionally specify an `imageURL` to have the picture of the item on the Zip product page. The shopper will see this image when they log in to their Zip account. The URL can have a maximum of 500 characters. | **Zip payment request** #### curl ```bash curl https://checkout-test.adyen.com/v71/sessions \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_REFERENCE", "amount": { "currency": "AUD", "value": 1000 }, "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "shopperEmail": "shopper@email.com", "dateOfBirth": "1981-01-13", "telephoneNumber": "+61121212121", "billingAddress":{ "city":"Sydney", "country":"AU", "houseNumberOrName":"123", "postalCode":"2000", "stateOrProvince":"NSW", "street":"Happy Street" }, "deliveryAddress":{ "city":"Sydney", "country":"AU", "houseNumberOrName":"123", "postalCode":"2000", "stateOrProvince":"NSW", "street":"Happy Street" }, "lineItems":[ { "description":"Shoes", "quantity":"1", "amountIncludingTax":"400", "id":"Item #1" }, { "description":"Socks", "quantity":"2", "amountIncludingTax":"300", "id":"Item #2" } ], "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode":"AU" }' ``` #### Java ```java // Adyen Java API Library v39.3.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the LIVE environment, also include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) LineItem lineItem1 = new LineItem() .quantity(1L) .description("Shoes") .id("Item #1") .amountIncludingTax(400L); LineItem lineItem2 = new LineItem() .quantity(2L) .description("Socks") .id("Item #2") .amountIncludingTax(300L); Amount amount = new Amount() .currency("AUD") .value(1000L); Name name = new Name() .firstName("Simon") .lastName("Hopper"); DeliveryAddress deliveryAddress = new DeliveryAddress() .country("AU") .stateOrProvince("NSW") .city("Sydney") .houseNumberOrName("123") .street("Happy Street") .postalCode("2000"); BillingAddress billingAddress = new BillingAddress() .country("AU") .stateOrProvince("NSW") .city("Sydney") .houseNumberOrName("123") .street("Happy Street") .postalCode("2000"); CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest() .reference("YOUR_ORDER_REFERENCE") .lineItems(Arrays.asList(lineItem1, lineItem2)) .amount(amount) .shopperName(name) .telephoneNumber("+61121212121") .merchantAccount("YOUR_MERCHANT_ACCOUNT") .deliveryAddress(deliveryAddress) .shopperEmail("shopper@email.com") .billingAddress(billingAddress) .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy.."); // Send the request PaymentsApi service = new PaymentsApi(client); CreateCheckoutSessionResponse response = service.sessions(createCheckoutSessionRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php setXApiKey("ADYEN_API_KEY"); // For the LIVE environment, also include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $lineItem1 = new LineItem(); $lineItem1 ->setQuantity(1) ->setDescription("Shoes") ->setId("Item #1") ->setAmountIncludingTax(400); $lineItem2 = new LineItem(); $lineItem2 ->setQuantity(2) ->setDescription("Socks") ->setId("Item #2") ->setAmountIncludingTax(300); $amount = new Amount(); $amount ->setCurrency("AUD") ->setValue(1000); $name = new Name(); $name ->setFirstName("Simon") ->setLastName("Hopper"); $deliveryAddress = new DeliveryAddress(); $deliveryAddress ->setCountry("AU") ->setStateOrProvince("NSW") ->setCity("Sydney") ->setHouseNumberOrName("123") ->setStreet("Happy Street") ->setPostalCode("2000"); $billingAddress = new BillingAddress(); $billingAddress ->setCountry("AU") ->setStateOrProvince("NSW") ->setCity("Sydney") ->setHouseNumberOrName("123") ->setStreet("Happy Street") ->setPostalCode("2000"); $createCheckoutSessionRequest = new CreateCheckoutSessionRequest(); $createCheckoutSessionRequest ->setReference("YOUR_ORDER_REFERENCE") ->setLineItems(array($lineItem1, $lineItem2)) ->setAmount($amount) ->setShopperName($name) ->setTelephoneNumber("+61121212121") ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setDeliveryAddress($deliveryAddress) ->setShopperEmail("shopper@email.com") ->setBillingAddress($billingAddress) ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy.."); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->sessions($createCheckoutSessionRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v32.1.1 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the LIVE environment, also include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) LineItem lineItem1 = new LineItem { Quantity = 1, Description = "Shoes", Id = "Item #1", AmountIncludingTax = 400 }; LineItem lineItem2 = new LineItem { Quantity = 2, Description = "Socks", Id = "Item #2", AmountIncludingTax = 300 }; Amount amount = new Amount { Currency = "AUD", Value = 1000 }; Name name = new Name { FirstName = "Simon", LastName = "Hopper" }; DeliveryAddress deliveryAddress = new DeliveryAddress { Country = "AU", StateOrProvince = "NSW", City = "Sydney", HouseNumberOrName = "123", Street = "Happy Street", PostalCode = "2000" }; BillingAddress billingAddress = new BillingAddress { Country = "AU", StateOrProvince = "NSW", City = "Sydney", HouseNumberOrName = "123", Street = "Happy Street", PostalCode = "2000" }; CreateCheckoutSessionRequest createCheckoutSessionRequest = new CreateCheckoutSessionRequest { Reference = "YOUR_ORDER_REFERENCE", LineItems = new List{ lineItem1, lineItem2 }, Amount = amount, ShopperName = name, TelephoneNumber = "+61121212121", MerchantAccount = "YOUR_MERCHANT_ACCOUNT", DeliveryAddress = deliveryAddress, ShopperEmail = "shopper@email.com", BillingAddress = billingAddress, ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy.." }; // Send the request var service = new PaymentsService(client); var response = service.Sessions(createCheckoutSessionRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v29.0.0 const { Client, CheckoutAPI } = require('@adyen/api-library'); // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const createCheckoutSessionRequest = { merchantAccount: "YOUR_MERCHANT_ACCOUNT", reference: "YOUR_ORDER_REFERENCE", amount: { currency: "AUD", value: 1000 }, telephoneNumber: "+61121212121", shopperEmail: "shopper@email.com", shopperName: { firstName: "Simon", lastName: "Hopper" }, billingAddress: { city: "Sydney", country: "AU", houseNumberOrName: "123", postalCode: "2000", stateOrProvince: "NSW", street: "Happy Street" }, deliveryAddress: { city: "Sydney", country: "AU", houseNumberOrName: "123", postalCode: "2000", stateOrProvince: "NSW", street: "Happy Street" }, lineItems: [ { description: "Shoes", quantity: "1", amountIncludingTax: "400", id: "Item #1" }, { description: "Socks", quantity: "2", amountIncludingTax: "300", id: "Item #2" } ], dateOfBirth: new Date("1996-09-04"), returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy.." } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v21.0.0 import ( "context" "github.com/adyen/adyen-go-api-library/v21/src/common" "github.com/adyen/adyen-go-api-library/v21/src/adyen" "github.com/adyen/adyen-go-api-library/v21/src/checkout" ) // For the LIVE environment, also include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) lineItem1 := checkout.LineItem{ Quantity: common.PtrInt64(1), Description: common.PtrString("Shoes"), Id: common.PtrString("Item #1"), AmountIncludingTax: common.PtrInt64(400), } lineItem2 := checkout.LineItem{ Quantity: common.PtrInt64(2), Description: common.PtrString("Socks"), Id: common.PtrString("Item #2"), AmountIncludingTax: common.PtrInt64(300), } amount := checkout.Amount{ Currency: "AUD", Value: 1000, } name := checkout.Name{ FirstName: "Simon", LastName: "Hopper", } deliveryAddress := checkout.DeliveryAddress{ Country: "AU", StateOrProvince: common.PtrString("NSW"), City: "Sydney", HouseNumberOrName: "123", Street: "Happy Street", PostalCode: "2000", } billingAddress := checkout.BillingAddress{ Country: "AU", StateOrProvince: common.PtrString("NSW"), City: "Sydney", HouseNumberOrName: "123", Street: "Happy Street", PostalCode: "2000", } createCheckoutSessionRequest := checkout.CreateCheckoutSessionRequest{ Reference: "YOUR_ORDER_REFERENCE", LineItems: []checkout.LineItem{ lineItem1, lineItem2, }, Amount: amount, ShopperName: &name, TelephoneNumber: common.PtrString("+61121212121"), MerchantAccount: "YOUR_MERCHANT_ACCOUNT", DeliveryAddress: &deliveryAddress, ShopperEmail: common.PtrString("shopper@email.com"), BillingAddress: &billingAddress, ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", } // Send the request service := client.Checkout() req := service.PaymentsApi.SessionsInput().IdempotencyKey("UUID").CreateCheckoutSessionRequest(createCheckoutSessionRequest) res, httpRes, err := service.PaymentsApi.Sessions(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v13.6.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_REFERENCE", "amount": { "currency": "AUD", "value": 1000 }, "telephoneNumber": "+61121212121", "shopperEmail": "shopper@email.com", "shopperName": { "firstName": "Simon", "lastName": "Hopper" }, "billingAddress": { "city": "Sydney", "country": "AU", "houseNumberOrName": "123", "postalCode": "2000", "stateOrProvince": "NSW", "street": "Happy Street" }, "deliveryAddress": { "city": "Sydney", "country": "AU", "houseNumberOrName": "123", "postalCode": "2000", "stateOrProvince": "NSW", "street": "Happy Street" }, "lineItems": [ { "description": "Shoes", "quantity": "1", "amountIncludingTax": "400", "id": "Item #1" }, { "description": "Socks", "quantity": "2", "amountIncludingTax": "300", "id": "Item #2" } ], "dateOfBirth": "1996-09-04", "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy.." } # Send the request result = adyen.checkout.payments_api.sessions(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v10.4.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the LIVE environment, also include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :reference => 'YOUR_ORDER_REFERENCE', :amount => { :currency => 'AUD', :value => 1000 }, :telephoneNumber => '+61121212121', :shopperEmail => 'shopper@email.com', :shopperName => { :firstName => 'Simon', :lastName => 'Hopper' }, :billingAddress => { :city => 'Sydney', :country => 'AU', :houseNumberOrName => '123', :postalCode => '2000', :stateOrProvince => 'NSW', :street => 'Happy Street' }, :deliveryAddress => { :city => 'Sydney', :country => 'AU', :houseNumberOrName => '123', :postalCode => '2000', :stateOrProvince => 'NSW', :street => 'Happy Street' }, :lineItems => [ { :description => 'Shoes', :quantity => '1', :amountIncludingTax => '400', :id => 'Item #1' }, { :description => 'Socks', :quantity => '2', :amountIncludingTax => '300', :id => 'Item #2' } ], :dateOfBirth => '1996-09-04', :returnUrl => 'https://your-company.example.com/checkout?shopperOrder=12xy..' } # Send the request result = adyen.checkout.payments_api.sessions(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v29.0.0 import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // For the LIVE environment, also include your liveEndpointUrlPrefix. const config = new Config({ apiKey: "ADYEN_API_KEY", environment: EnvironmentEnum.TEST }); const client = new Client(config); // Create the request object(s) const lineItem1: Types.checkout.LineItem = { quantity: 1, description: "Shoes", id: "Item #1", amountIncludingTax: 400 }; const lineItem2: Types.checkout.LineItem = { quantity: 2, description: "Socks", id: "Item #2", amountIncludingTax: 300 }; const amount: Types.checkout.Amount = { currency: "AUD", value: 1000 }; const name: Types.checkout.Name = { firstName: "Simon", lastName: "Hopper" }; const deliveryAddress: Types.checkout.DeliveryAddress = { country: "AU", stateOrProvince: "NSW", city: "Sydney", houseNumberOrName: "123", street: "Happy Street", postalCode: "2000" }; const billingAddress: Types.checkout.BillingAddress = { country: "AU", stateOrProvince: "NSW", city: "Sydney", houseNumberOrName: "123", street: "Happy Street", postalCode: "2000" }; const createCheckoutSessionRequest: Types.checkout.CreateCheckoutSessionRequest = { reference: "YOUR_ORDER_REFERENCE", lineItems: [lineItem1, lineItem2], amount: amount, shopperName: name, telephoneNumber: "+61121212121", merchantAccount: "YOUR_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, shopperEmail: "shopper@email.com", billingAddress: billingAddress, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy.." }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.sessions(createCheckoutSessionRequest, { idempotencyKey: "UUID" }); ``` ### Tab: `/payments` If you implemented an [additional use case](/online-payments/build-your-integration). | Parameter name | Required | Description | | --------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [shopperName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperName) | | Shopper's first name and last name. | | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperEmail) | | The shopper's email address. | | [dateOfBirth](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-dateOfBirth) | | The shopper's date of birth. | | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-telephoneNumber) | | The shopper's phone number. | | [paymentMethod.clickAndCollect](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-ZipDetails-clickAndCollect) | | Set this to **true** if the shopper wants to pick up and collect their order, instead of having the goods delivered to them. | | [billingAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-billingAddress) | | The address where to send the invoice. | | [deliveryAddress](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-deliveryAddress) | | The address where the purchased goods should be delivered. | | [lineItems](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-lineItems) | | Price and product information about the purchased items. You can optionally specify an `imageURL` to have the picture of the item on the Zip product page. The shopper will see this image when they log in to their Zip account. The URL can have a maximum of 500 characters. | **Zip payment request** #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "merchantAccount":"ADYEN_MERCHANT_ACCOUNT", "reference":"YOUR_ORDER_NUMBER", "amount":{ "currency":"AUD", "value":1000 }, "paymentMethod":{ "type":"zip", {hint:If the shopper will pick up their order}"clickAndCollect": true{/hint} }, "shopperName":{ "firstName":"Happy", "lastName":"Testing" }, "shopperEmail":"shopper@email.com", "dateOfBirth": "1981-01-13", "telephoneNumber":"+85121212121", "billingAddress":{ "city":"Sydney", "country":"AU", "houseNumberOrName":"123", "postalCode":"2000", "stateOrProvince":"NSW", "street":"Happy Street" }, "deliveryAddress":{ "city":"Sydney", "country":"AU", "houseNumberOrName":"123", "postalCode":"2000", "stateOrProvince":"NSW", "street":"Happy Street" }, "lineItems":[ { "description":"Shoes", "quantity":"1", "amountIncludingTax":"400", "id":"Item #1" }, { "description":"Socks", "quantity":"2", "amountIncludingTax":"300", "id":"Item #2" } ], "returnUrl":"https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode":"AU" }' ``` #### Java ```java // Adyen Java API Library v27.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.checkout.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.model.RequestOptions; import com.adyen.service.checkout.*; // For the live environment, additionally include your liveEndpointUrlPrefix. Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) Amount amount = new Amount() .currency("AUD") .value(1000L); LineItem lineItem1 = new LineItem() .quantity(1L) .description("Shoes") .id("Item #1") .amountIncludingTax(400L); LineItem lineItem2 = new LineItem() .quantity(2L) .description("Socks") .id("Item #2") .amountIncludingTax(300L); Name name = new Name() .firstName("Happy") .lastName("Testing"); DeliveryAddress deliveryAddress = new DeliveryAddress() .country("AU") .stateOrProvince("NSW") .city("Sydney") .houseNumberOrName("123") .street("Happy Street") .postalCode("2000"); ZipDetails zipDetails = new ZipDetails() .type(ZipDetails.TypeEnum.ZIP); BillingAddress billingAddress = new BillingAddress() .country("AU") .stateOrProvince("NSW") .city("Sydney") .houseNumberOrName("123") .street("Happy Street") .postalCode("2000"); PaymentRequest paymentRequest = new PaymentRequest() .amount(amount) .telephoneNumber("+85121212121") .shopperEmail("shopper@email.com") .dateOfBirth(OffsetDateTime.parse("1981-01-13")) .reference("YOUR_ORDER_NUMBER") .lineItems(Arrays.asList(lineItem1, lineItem2)) .shopperName(name) .merchantAccount("ADYEN_MERCHANT_ACCOUNT") .deliveryAddress(deliveryAddress) .countryCode("AU") .paymentMethod(new CheckoutPaymentMethod(zipDetails)) .billingAddress(billingAddress) .returnUrl("https://your-company.example.com/checkout?shopperOrder=12xy.."); // Send the request PaymentsApi service = new PaymentsApi(client); PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID")); ``` #### PHP ```php // Adyen PHP API Library v19.0.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\Checkout\Amount; use Adyen\Model\Checkout\LineItem; use Adyen\Model\Checkout\Name; use Adyen\Model\Checkout\DeliveryAddress; use Adyen\Model\Checkout\CheckoutPaymentMethod; use Adyen\Model\Checkout\BillingAddress; use Adyen\Model\Checkout\PaymentRequest; use Adyen\Service\Checkout\PaymentsApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); // For the live environment, additionally include your liveEndpointUrlPrefix. $client->setEnvironment(Environment::TEST); // Create the request object(s) $amount = new Amount(); $amount ->setCurrency("AUD") ->setValue(1000); $lineItem1 = new LineItem(); $lineItem1 ->setQuantity(1) ->setDescription("Shoes") ->setId("Item #1") ->setAmountIncludingTax(400); $lineItem2 = new LineItem(); $lineItem2 ->setQuantity(2) ->setDescription("Socks") ->setId("Item #2") ->setAmountIncludingTax(300); $name = new Name(); $name ->setFirstName("Happy") ->setLastName("Testing"); $deliveryAddress = new DeliveryAddress(); $deliveryAddress ->setCountry("AU") ->setStateOrProvince("NSW") ->setCity("Sydney") ->setHouseNumberOrName("123") ->setStreet("Happy Street") ->setPostalCode("2000"); $checkoutPaymentMethod = new CheckoutPaymentMethod(); $checkoutPaymentMethod ->setType("zip"); $billingAddress = new BillingAddress(); $billingAddress ->setCountry("AU") ->setStateOrProvince("NSW") ->setCity("Sydney") ->setHouseNumberOrName("123") ->setStreet("Happy Street") ->setPostalCode("2000"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setAmount($amount) ->setTelephoneNumber("+85121212121") ->setShopperEmail("shopper@email.com") ->setDateOfBirth("1981-01-13") ->setReference("YOUR_ORDER_NUMBER") ->setLineItems(array($lineItem1, $lineItem2)) ->setShopperName($name) ->setMerchantAccount("ADYEN_MERCHANT_ACCOUNT") ->setDeliveryAddress($deliveryAddress) ->setCountryCode("AU") ->setPaymentMethod($checkoutPaymentMethod) ->setBillingAddress($billingAddress) ->setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy.."); $requestOptions['idempotencyKey'] = 'UUID'; // Send the request $service = new PaymentsApi($client); $response = $service->payments($paymentRequest, $requestOptions); ``` #### C\# ```cs // Adyen .net API Library v17.0.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.Checkout; using Adyen.Service.Checkout; // For the live environment, additionally include your liveEndpointUrlPrefix. var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) Amount amount = new Amount { Currency = "AUD", Value = 1000 }; LineItem lineItem1 = new LineItem { Quantity = 1, Description = "Shoes", Id = "Item #1", AmountIncludingTax = 400 }; LineItem lineItem2 = new LineItem { Quantity = 2, Description = "Socks", Id = "Item #2", AmountIncludingTax = 300 }; Name name = new Name { FirstName = "Happy", LastName = "Testing" }; DeliveryAddress deliveryAddress = new DeliveryAddress { Country = "AU", StateOrProvince = "NSW", City = "Sydney", HouseNumberOrName = "123", Street = "Happy Street", PostalCode = "2000" }; ZipDetails zipDetails = new ZipDetails { Type = ZipDetails.TypeEnum.Zip }; BillingAddress billingAddress = new BillingAddress { Country = "AU", StateOrProvince = "NSW", City = "Sydney", HouseNumberOrName = "123", Street = "Happy Street", PostalCode = "2000" }; PaymentRequest paymentRequest = new PaymentRequest { Amount = amount, TelephoneNumber = "+85121212121", ShopperEmail = "shopper@email.com", DateOfBirth = DateTime.Parse("1981-01-13"), Reference = "YOUR_ORDER_NUMBER", LineItems = new List{ lineItem1, lineItem2 }, ShopperName = name, MerchantAccount = "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress = deliveryAddress, CountryCode = "AU", PaymentMethod = new CheckoutPaymentMethod(zipDetails), BillingAddress = billingAddress, ReturnUrl = "https://your-company.example.com/checkout?shopperOrder=12xy.." }; // Send the request var service = new PaymentsService(client); var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"}); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const paymentRequest = { merchantAccount: "ADYEN_MERCHANT_ACCOUNT", reference: "YOUR_ORDER_NUMBER", amount: { currency: "AUD", value: 1000 }, paymentMethod: { type: "zip" }, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", countryCode: "AU", shopperName: { firstName: "Happy", lastName: "Testing" }, shopperEmail: "shopper@email.com", dateOfBirth: new Date("1981-01-13"), telephoneNumber: "+85121212121", billingAddress: { city: "Sydney", country: "AU", houseNumberOrName: "123", postalCode: "2000", stateOrProvince: "NSW", street: "Happy Street" }, deliveryAddress: { city: "Sydney", country: "AU", houseNumberOrName: "123", postalCode: "2000", stateOrProvince: "NSW", street: "Happy Street" }, lineItems: [ { description: "Shoes", quantity: "1", amountIncludingTax: "400", id: "Item #1" }, { description: "Socks", quantity: "2", amountIncludingTax: "300", id: "Item #2" } ] } // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Go ```go // Adyen Go API Library v10.4.0 import ( "context" "time" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/checkout" ) // For the live environment, additionally include your liveEndpointUrlPrefix. client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) amount := checkout.Amount{ Currency: "AUD", Value: 1000, } lineItem1 := checkout.LineItem{ Quantity: common.PtrInt64(1), Description: common.PtrString("Shoes"), Id: common.PtrString("Item #1"), AmountIncludingTax: common.PtrInt64(400), } lineItem2 := checkout.LineItem{ Quantity: common.PtrInt64(2), Description: common.PtrString("Socks"), Id: common.PtrString("Item #2"), AmountIncludingTax: common.PtrInt64(300), } name := checkout.Name{ FirstName: "Happy", LastName: "Testing", } deliveryAddress := checkout.DeliveryAddress{ Country: "AU", StateOrProvince: common.PtrString("NSW"), City: "Sydney", HouseNumberOrName: "123", Street: "Happy Street", PostalCode: "2000", } zipDetails := checkout.ZipDetails{ Type: common.PtrString("zip"), } billingAddress := checkout.BillingAddress{ Country: "AU", StateOrProvince: common.PtrString("NSW"), City: "Sydney", HouseNumberOrName: "123", Street: "Happy Street", PostalCode: "2000", } paymentRequest := checkout.PaymentRequest{ Amount: amount, TelephoneNumber: common.PtrString("+85121212121"), ShopperEmail: common.PtrString("shopper@email.com"), DateOfBirth: func() *time.Time { t, _ := time.Parse(time.RFC3339, "1981-01-13"); return &t }(), Reference: "YOUR_ORDER_NUMBER", LineItems: []checkout.LineItem{ lineItem1, lineItem2, }, ShopperName: &name, MerchantAccount: "ADYEN_MERCHANT_ACCOUNT", DeliveryAddress: &deliveryAddress, CountryCode: common.PtrString("AU"), PaymentMethod: checkout.ZipDetailsAsCheckoutPaymentMethod(&zipDetails), BillingAddress: &billingAddress, ReturnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy..", } // Send the request service := client.Checkout() req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest) res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.5.1 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "merchantAccount": "ADYEN_MERCHANT_ACCOUNT", "reference": "YOUR_ORDER_NUMBER", "amount": { "currency": "AUD", "value": 1000 }, "paymentMethod": { "type": "zip" }, "returnUrl": "https://your-company.example.com/checkout?shopperOrder=12xy..", "countryCode": "AU", "shopperName": { "firstName": "Happy", "lastName": "Testing" }, "shopperEmail": "shopper@email.com", "dateOfBirth": "1981-01-13", "telephoneNumber": "+85121212121", "billingAddress": { "city": "Sydney", "country": "AU", "houseNumberOrName": "123", "postalCode": "2000", "stateOrProvince": "NSW", "street": "Happy Street" }, "deliveryAddress": { "city": "Sydney", "country": "AU", "houseNumberOrName": "123", "postalCode": "2000", "stateOrProvince": "NSW", "street": "Happy Street" }, "lineItems": [ { "description": "Shoes", "quantity": "1", "amountIncludingTax": "400", "id": "Item #1" }, { "description": "Socks", "quantity": "2", "amountIncludingTax": "300", "id": "Item #2" } ] } # Send the request result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.5.1 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' # For the live environment, additionally include your liveEndpointUrlPrefix. adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :merchantAccount => 'ADYEN_MERCHANT_ACCOUNT', :reference => 'YOUR_ORDER_NUMBER', :amount => { :currency => 'AUD', :value => 1000 }, :paymentMethod => { :type => 'zip' }, :returnUrl => 'https://your-company.example.com/checkout?shopperOrder=12xy..', :countryCode => 'AU', :shopperName => { :firstName => 'Happy', :lastName => 'Testing' }, :shopperEmail => 'shopper@email.com', :dateOfBirth => '1981-01-13', :telephoneNumber => '+85121212121', :billingAddress => { :city => 'Sydney', :country => 'AU', :houseNumberOrName => '123', :postalCode => '2000', :stateOrProvince => 'NSW', :street => 'Happy Street' }, :deliveryAddress => { :city => 'Sydney', :country => 'AU', :houseNumberOrName => '123', :postalCode => '2000', :stateOrProvince => 'NSW', :street => 'Happy Street' }, :lineItems => [ { :description => 'Shoes', :quantity => '1', :amountIncludingTax => '400', :id => 'Item #1' }, { :description => 'Socks', :quantity => '2', :amountIncludingTax => '300', :id => 'Item #2' } ] } # Send the request result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v18.0.0 // Require the parts of the module you want to use import { Client, CheckoutAPI, Types } from "@adyen/api-library"; // Initialize the client object // For the live environment, additionally include your liveEndpointUrlPrefix. const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const amount: Types.checkout.Amount = { currency: "AUD", value: 1000 }; const lineItem1: Types.checkout.LineItem = { quantity: 1, description: "Shoes", id: "Item #1", amountIncludingTax: 400 }; const lineItem2: Types.checkout.LineItem = { quantity: 2, description: "Socks", id: "Item #2", amountIncludingTax: 300 }; const name: Types.checkout.Name = { firstName: "Happy", lastName: "Testing" }; const deliveryAddress: Types.checkout.DeliveryAddress = { country: "AU", stateOrProvince: "NSW", city: "Sydney", houseNumberOrName: "123", street: "Happy Street", postalCode: "2000" }; const zipDetails: Types.checkout.ZipDetails = { type: Types.checkout.ZipDetails.TypeEnum.Zip }; const billingAddress: Types.checkout.BillingAddress = { country: "AU", stateOrProvince: "NSW", city: "Sydney", houseNumberOrName: "123", street: "Happy Street", postalCode: "2000" }; const paymentRequest: Types.checkout.PaymentRequest = { amount: amount, telephoneNumber: "+85121212121", shopperEmail: "shopper@email.com", dateOfBirth: new Date("1981-01-13"), reference: "YOUR_ORDER_NUMBER", lineItems: [lineItem1, lineItem2], shopperName: name, merchantAccount: "ADYEN_MERCHANT_ACCOUNT", deliveryAddress: deliveryAddress, countryCode: "AU", paymentMethod: zipDetails, billingAddress: billingAddress, returnUrl: "https://your-company.example.com/checkout?shopperOrder=12xy.." }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` In the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response, check the `action` object for the information that you must use to redirect the shopper. **/payments response** ```json { "resultCode":"RedirectShopper", "action":{ "paymentMethodType":"zip", "method":"GET", "url":"https://checkoutshopper-test.adyen.com/checkoutshopper/checkoutPaymentRedirect?redirectData=...", "type":"redirect" } } ``` ## Component configuration ### Step 1: Create a DOM element Create a DOM element on your checkout page, placing it where you want the payment method form to be rendered: ```html
``` ### Step 2: Create an instance of the Component #### v6.0.0 or later Create an instance of the Component, passing: * Your instance of `AdyenCheckout`. ```js const zip = new Redirect(checkout, { type: 'zip' }).mount('#zip-container'); ``` ** #### v5.x.x or earlier Use the `create` method of your `AdyenCheckout` instance, in this case `checkout`, to create the Component: ```js const zipComponent = checkout.create('zip').mount('#zip-container'); ``` ## Recurring payments We support recurring transactions for Zip. To make recurring payments, you need to: 1. [Create a shopper token](#create-a-token). 2. [Use the token to make future payments for the shopper](#make-payment-with-token). ### Create a token To create a token, include in your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request: * `storePaymentMethod`: **true** * [shopperReference](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperReference): Your unique identifier for the shopper. When the payment has been settled, you receive a [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) [webhook](/development-resources/webhooks) containing: * `type`: **recurring.token.created** * `shopperReference`: Your unique identifier for the shopper. * `eventId`: The `pspReference` of the initial payment. * `storedPaymentMethodId`: The token that you need to make recurring payments for this shopper. Make sure that your server is able to receive the [Recurring tokens life cycle events](/development-resources/webhooks/webhook-types/#other-webhooks?target=_blank) webhook. You can [set up this webhook in your Customer Area](/development-resources/webhooks/#set-up-webhooks-in-your-customer-area?target=_blank). ### Make a payment with a token To make a payment with the token, include in your [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request: * `paymentMethod.storedPaymentMethodId`: The `storedPaymentMethodId` from the [recurring.token.created](https://docs.adyen.com/api-explorer/Tokenization-webhooks/latest/post/recurring.token.created) webhook.\ You can also get this value using the [/listRecurringDetails](https://docs.adyen.com/api-explorer/Recurring/latest/post/listRecurringDetails) endpoint. * `shopperReference`: The unique shopper identifier that you specified when creating the token. * `shopperInteraction`: **ContAuth**. * `recurringProcessingModel`: **Subscription** or **UnscheduledCardOnFile**. For more information about the `shopperInteraction` and `recurringProcessingModel` fields, refer to [Tokenization](/online-payments/tokenization). #### curl ```bash curl https://checkout-test.adyen.com/v72/payments \ -H 'x-api-key: ADYEN_API_KEY' \ -H 'content-type: application/json' \ -d '{ "amount":{ "value":1000, "currency":"AUD" }, "paymentMethod":{ "type":"zip", "storedPaymentMethodId":"7219687191761347" }, "reference":"YOUR_ORDER_NUMBER", "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", "shopperInteraction":"ContAuth", "recurringProcessingModel": "Subscription" }' ``` #### Java ```java // Set ADYEN_API_KEY with the API key from the Customer Area. // Change to Environment.LIVE and add the Live URL prefix when you are ready to accept live payments. Client client = new Client("ADYEN_API_KEY", Environment.TEST); Checkout checkout = new Checkout(client); PaymentsRequest paymentsRequest = new PaymentsRequest(); String merchantAccount = "YOUR_MERCHANT_ACCOUNT"; paymentsRequest.setMerchantAccount(merchantAccount); Amount amount = new Amount(); amount.setCurrency("AUD"); amount.setValue(1000L); paymentsRequest.setAmount(amount); DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); paymentMethodDetails.setRecurringDetailReference("7219687191761347"); paymentMethodDetails.setType("zip"); paymentsRequest.setPaymentMethod(paymentMethodDetails); paymentsRequest.setReference("YOUR_ORDER_NUMBER"); paymentsRequest.setReturnUrl("https://your-company.example.com/checkout?shopperOrder=12xy.."); paymentsRequest.setShopperInteraction("ContAuth"); paymentsRequest.setRecurringProcessingModel("Subscription"); PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest); ``` #### PHP ```php // Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("ADYEN_API_KEY"); $service = new \Adyen\Service\Checkout($client); $params = array( "amount" => array( "currency" => "AUD", "value" => 1000 ), "reference" => "YOUR_ORDER_NUMBER", "paymentMethod" => array( "type" => "zip", "storedPaymentMethodId" => "7219687191761347" ), "returnUrl" => "https://your-company.example.com/checkout?shopperOrder=12xy..", "shopperReference" => "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", "recurringProcessingModel" => "Subscription", "shopperInteraction" => "ContAuth", "merchantAccount" => "YOUR_MERCHANT_ACCOUNT" ); $result = $service->payments($params); ``` #### C\# ```cs // Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("ADYEN_API_KEY", Environment.Test); var checkout = new Checkout(client); var amount = new Adyen.Model.Checkout.Amount("AUD", 1000); var details = new Adyen.Model.Checkout.DefaultPaymentMethodDetails{ Type = "zip", StoredPaymentMethodId = "7219687191761347" }; var paymentsRequest = new Adyen.Model.Checkout.PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, ReturnUrl = @"https://your-company.example.com/checkout?shopperOrder=12xy..", MerchantAccount = "YOUR_MERCHANT_ACCOUNT", ShopperReference = "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", RecurringProcessingModel = Adyen.Model.Checkout.PaymentRequest.RecurringProcessingModelEnum.Subscription, ShopperInteraction = Adyen.Model.Checkout.PaymentRequest.ShopperInteractionEnum.ContAuth, PaymentMethod = details }; var paymentResponse = checkout.Payments(paymentsRequest); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.1.0 // Require the parts of the module you want to use const { Client, CheckoutAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "YOUR_X_API_KEY", environment: "TEST"}); // Create the request object const paymentRequest = { amount: { value: 1000, currency: "AUD" }, paymentMethod: { type: "zip", storedPaymentMethodId: "7219687191761347" }, reference: "YOUR_ORDER_NUMBER", merchantAccount: "YOUR_MERCHANT_ACCOUNT", shopperReference: "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", shopperInteraction: "ContAuth", recurringProcessingModel: "Subscription" } // Make the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` #### Python ```py # Adyen Python API Library v12.0.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "YOUR_X_API_KEY" adyen.client.platform = "test" # The environment to use library in. json_request = { "amount": { "value": 1000, "currency": "AUD" }, "paymentMethod": { "type": "zip", "storedPaymentMethodId": "7219687191761347" }, "reference": "YOUR_ORDER_NUMBER", "merchantAccount": "YOUR_MERCHANT_ACCOUNT", "shopperReference": "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j", "shopperInteraction": "ContAuth", "recurringProcessingModel": "Subscription" } result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID") ``` #### Ruby ```rb # Adyen Ruby API Library v9.1.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'YOUR_X_API_KEY' adyen.env = :test # Set to "live" for live environment request_body = { :amount => { :value => 1000, :currency => 'AUD' }, :paymentMethod => { :type => 'zip', :storedPaymentMethodId => '7219687191761347' }, :reference => 'YOUR_ORDER_NUMBER', :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :shopperReference => 'YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j', :shopperInteraction => 'ContAuth', :recurringProcessingModel => 'Subscription' } result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' }) ``` ## Test and go live Create Zip test accounts using the credentials on Zip's [test credentials](https://developers.zip.co/v2/docs/test-customers) page. You can then use your test account to make a payment in the test environment. Check the status of Zip test payments in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**. Before you can accept live Zip payments, you need to submit a request for Zip in your [live Customer Area](https://ca-live.adyen.com/). ## See also * [Web Components integration guide](/online-payments/components-web) * [Webhooks](/development-resources/webhooks) * [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)