@alifraz456 Like I said, you cannot send that address to the Wix Pay API. The API only supports these user information.
You could however code a custom email to be sent out to the site owner.
For example: I create my payment object on the checkout page by making the user fill out the following data:
1. First Name
2. Last Name
3. Street
4. City
5. State
6. Postal Code
7. Country
Now in order to create a payment object I need the Item name and price which I can get from the page using code so the final information i will send to the backend createPayment function will be the following:
1. Item Name (got using code)
2. Price (got using code)
3. User Email
4. First Name
5. Last Name
I send the above data to my backend file to get the payment id. In the meanwhile show a loading animation to the user.
//backend/pay.jsw
import wixPay from 'wix-pay-backend';
export function createMyPayment(item, price, fname, lname, email) {
return wixPay.createPayment({
items: [{
name: item,
price: price
}],
amount: price,
currency: "USD",
userInfo: {
firstName: fname,
lastName: lname,
email: email
}
});
}
Once the backend function sends me the response (payment.id) i use it to initiate the payment on the frontend:
wixPay.startPayment(payment.id, {"showThankYouPage": false})
.then( (result) => {
if (result.status === "Successful") {
//process order
} else {
//handle error
}
Now if the status is returned (from the Wix Pay window) as ‘Successful’ I can process the custom email and use the Shipping Data the customer has filled on the page along with the Item name to send a custom notification email to the site owner.
Take a look at this example to learn how to send custom coded emails using SendGrid.