Skip to content

Commit 1691659

Browse files
committed
Fix missing redirectURL setting when calling payment instrument patch API
1 parent 08c2cf6 commit 1691659

File tree

1 file changed

+8
-9
lines changed
  • packages/template-retail-react-app/app/components/sf-payments-express-buttons

1 file changed

+8
-9
lines changed

packages/template-retail-react-app/app/components/sf-payments-express-buttons/index.jsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,13 @@ const SFPaymentsExpressButtons = ({
270270
// Find SF Payments payment instrument in created order
271271
const orderPaymentInstrument = getSFPaymentsInstrument(order)
272272

273+
// Build the return URL (needed for updatePaymentInstrumentForOrder )
274+
const baseReturnUrl = `${window.location.protocol}//${window.location.host}/checkout/payment-processing`
275+
paymentData.returnUrl = baseReturnUrl +
276+
'?orderNo=' + encodeURIComponent(createdOrderNo) +
277+
'&zoneId=' + encodeURIComponent(zoneId) +
278+
'&type=' + encodeURIComponent(paymentType)
279+
273280
try {
274281
const paymentInstrumentBody = createPaymentInstrumentBody({
275282
amount: order.orderTotal,
@@ -944,15 +951,7 @@ const SFPaymentsExpressButtons = ({
944951

945952
const paymentMethodSet = {
946953
paymentMethods: paymentConfig.paymentMethods,
947-
// inject country code into payment method set accounts (Adyen seems to need it but Stripe works with/without it)
948-
paymentMethodSetAccounts:
949-
paymentConfig.paymentMethodSetAccounts?.map((account) => ({
950-
...account,
951-
config: {
952-
...account.config,
953-
country: paymentCountryCode || fallbackCountryCode || 'US' // Inject country here
954-
}
955-
})) || []
954+
paymentMethodSetAccounts: paymentConfig.paymentMethodSetAccounts || []
956955
}
957956
const config = {
958957
theme: buildTheme({

0 commit comments

Comments
 (0)