medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
26.23k stars 2.67k forks source link

Billing address is undefined in custom payment provider #10196

Open kocendavid opened 1 week ago

kocendavid commented 1 week ago

Bug report

Describe the bug

The flow is very simple user enters billing address, chooses shipping option and if all then is allowed to go to payment provider. The payment provider is custom and I have implemented initiate payment and update payment. When selecting payment provider both initiate and update payment are missing billing address in the context even though I can see billing address and billing address id in cart.

Custom payment provider doesnt get billing address in the context in initiate and update functions

System information

"@medusajs/admin": "7.1.14", "@medusajs/cache-inmemory": "^1.8.8", "@medusajs/cache-redis": "^1.9.0", "@medusajs/event-bus-local": "^1.9.6", "@medusajs/event-bus-redis": "^1.8.9", "@medusajs/file-local": "^1.0.2", "@medusajs/medusa": "1.20.0", "@medusajs/types": "1.11.16", "@tanstack/react-query": "4.22.0", "body-parser": "^1.19.0", "cors": "^2.8.5", "dotenv": "16.0.3", "express": "^4.17.2", "medusa-custom-attributes": "1.0.17", "medusa-file-minio": "^1.3.0", "medusa-fulfillment-manual": "^1.1.38", "medusa-interfaces": "1.3.9", "medusa-payment-manual": "^1.0.24", "medusa-payment-stripe": "6.0.9", "medusa-plugin-sendgrid": "^1.3.13", "postinstall-postinstall": "^2.1.0", "prism-react-renderer": "^2.0.4", "typeorm": "^0.3.16", "xml2js": "^0.6.2"

Node.js version: 20x Database: Operating system: win/mac

Expected behavior

Custom payment provider gets passed billing address everytime its present in cart

kasperkristensen commented 1 week ago

Hi @kocendavid, when you Initialize a payment session in your storefront, you can pass billing_address in the context field of the payload. We don't automatically populate the field.

See https://docs.medusajs.com/api/store#payment-collections_postpaymentcollectionsidpaymentsessions