@easypayment/medusa-paypal-ui 1.0.50 โ†’ 1.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -739,66 +739,6 @@ export default Payment
739
739
 
740
740
  ---
741
741
 
742
- ## ๐Ÿงพ Order confirmation page
743
-
744
- The Medusa starter's order page renders the payment method with a hard lookup:
745
-
746
- ```tsx
747
- // src/modules/order/components/payment-details/index.tsx
748
- {paymentInfoMap[payment.provider_id].title}
749
- ```
750
-
751
- `paymentInfoMap` has no entry for the PayPal providers (`pp_paypal_paypal`,
752
- `pp_paypal_card_paypal_card`), so this throws:
753
-
754
- ```
755
- Cannot read properties of undefined (reading 'title')
756
- ```
757
-
758
- Use the **server-safe** helpers from the `/order` subpath (no React, safe to
759
- import in the server-rendered order page). `fetchPayPalConfig` reads the titles
760
- configured in **Medusa Admin โ†’ Settings โ†’ PayPal** (`paypal_title` /
761
- `card_title`), so the order page shows the **same labels as checkout**:
762
-
763
- ```tsx
764
- import { getPaymentLabel, fetchPayPalConfig } from "@easypayment/medusa-paypal-ui/order"
765
-
766
- // Make the component async (it's a server component) and fetch the admin titles:
767
- const PaymentDetails = async ({ order }: { order: any }) => {
768
- const payment = order.payment_collections?.[0]?.payments?.[0]
769
-
770
- const titles = await fetchPayPalConfig({
771
- baseUrl: process.env.NEXT_PUBLIC_MEDUSA_BACKEND_URL!,
772
- publishableApiKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
773
- })
774
-
775
- return (
776
- // ...
777
- <Text className="txt-medium text-ui-fg-subtle" data-testid="payment-method">
778
- {getPaymentLabel(
779
- payment?.provider_id,
780
- paymentInfoMap[payment?.provider_id]?.title,
781
- titles
782
- )}
783
- </Text>
784
- // ...
785
- )
786
- }
787
- ```
788
-
789
- If that component also renders an icon, guard it too:
790
-
791
- ```tsx
792
- {paymentInfoMap[payment.provider_id]?.icon ?? <CreditCard />}
793
- ```
794
-
795
- `getPaymentLabel(providerId, fallback?, titles?)` resolves, in order: the
796
- **admin-configured PayPal/card title** (`titles`) โ†’ built-in default โ†’ your
797
- `fallback` โ†’ the raw id. It never throws on an unknown provider. If you'd rather
798
- not fetch, omit `titles` and it falls back to the default labels.
799
-
800
- ---
801
-
802
742
  ## ๐Ÿงช Testing
803
743
 
804
744
  Toggle between sandbox and live in **Medusa Admin โ†’ Settings โ†’ PayPal โ†’ PayPal Connection โ†’ Environment**.