How to fill the buyer's email and first and lastname

Olilou
Contributor
Contributor

Hi,

 

I'm trying to find how to fill the shipping informations in paypal.

 

Here is my code :

 

 

 

 

createOrder: function(data, actions) {
                return actions.order.create({
                    purchase_units: [{
                        reference_id: "PUHF",
                    description: "Some description",

                    custom_id: "Something7364",
                    soft_descriptor: "Great description 1",
                    amount: {
                        currency_code: "EUR",
                        value: "234.00",
                        breakdown: {
                            item_total: {
                                currency_code: "EUR",
                                value: "200.00"
                            },
                            tax_total: {
	                            currency_code: "EUR",
                                value: "20.00"
	                        },
                            discount: {	
	                            currency_code: "EUR",
                                value: "5.00"
	                        },
                            shipping: {
	                            currency_code: "EUR",
                                value: "20.00"
	                        },
	                        insurance: {
	                            currency_code: "EUR",
                                value: "1.00"
	                        },
	                        shipping_discount: {
	                            currency_code: "EUR",
                                value: "2.00"
	                        }
                        }
                    },
                    items: [
                        {
                            name: "Item 1",
                            description: "The best item ever",
                            sku: "xyz-2654",
                            unit_amount: {
                                currency_code: "EUR",
                                value: "100.00"
                            },
                            quantity: "1"
                        },
                        {
                            name: "Item 2",
                            description: "Not bad too",
                            sku: "zdc-3942",
                            unit_amount: {
                                currency_code: "EUR",
                                value: "50.00"
                            },
                            quantity: "2"
                        }
                    ],
                    shipping: {
                      	address: {
                      	    name: {
                      	        given_name: 'Jean',
                      	        surname: 'Martin'
                      	    },
                      	    email_address: 'jeanmartin[at]email.com',
                      		address_line_1: "218 rue de la liberté",
							address_line_2: "",
							admin_area_2: "Paris",
							admin_area_1: "",
							postal_code: "75000",
							country_code: "FR",
                      	}
                  	}
                    }]
                });
            },

 

The shipping address is well filled but the name and email address are not filled in paypal page.

Is someone can help me to pass the right parameters to paypal please ?

Thank in advance !

Login to Me Too
1 REPLY 1

MTS-Aaron
PayPal Employee
PayPal Employee

Hi @Olilou 

 

That's a great question! Just from looking at your code, it looks like you've got the "Name" object inside of the "Address" object. From the documentation here, it looks like it should be this inside the shipping object:

Name: { full_name: 'Jean Martin' },
Address:{ 
	address_line_1: "218 rue de la liberté",
	address_line_2: "",
	admin_area_2: "Paris",
	admin_area_1: "",
	postal_code: "75000",
	country_code: "FR" }

 

Hope that helps!

-Aaron

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.