I am using Pay With Amazon Express Integration. In that I have to create custom Pay With Amazon
button as described here:
Everything is working smoothly, however when I click on Pay With Amazon
button, it opens window in same page. I want that window to open in popup
.
Is there any way, I can make Pay With Amazon
button to open window
in popup
.
Here is my code:
<script type="text/javascript">
OffAmazonPayments.Button("AmazonPayButton", app.conf.amazonPaySellerId, {
type: "hostedPayment",
hostedParametersProvider: function(done) {
$.getJSON(app.conf.siteUrl + 'generatePaymentRequestSignature', {
amount: $("#depositAmount").val() ? $("#depositAmount").val() : 10,
currencyCode: 'USD',
sellerNote: "Deposit to App",
returnURL : window.location.href,
sellerOrderId : localStorage.getItem("UserAccessToken")
},
function(data) {
if(data.status && data.code == 200) {
done(JSON.parse(data.data));
} else {
alert("Service is not available. Please try again later");
}
})
},
onError: function(errorCode) {
console.log(errorCode.getErrorCode() + " " + errorCode.getErrorMessage());
}
});
</script>
I wanted to open it in popup, because my app will be embedded by other sites using iframe
. And when we click on Pay
button, it opens in same window which is not functioning.
Note: There is option available for opening window in Popup, for Buttons generated using Button Generator Utility as said here, but don't know how it can be done using hostedPayment
type.
Thanks for your time.
There isn't a way to do that currently since it is a hosted solution. The sample you referenced doesn't use the button generator it uses a standard Login with Amazon integration. A button generated with the button generator is considered a Express integration.
The only way to have a popup experience is to do a custom LPA integration but the Pay button will not work in a iframe.