Repository navigation
fix(setups): align the payment setup request shape with the spec - #254
rodrigojara-cko wants to merge 1 commit into
Conversation
🟡 Risk Classification: MINORApproval route: AI Review + Human Approval Classification reasons
Operational gates
Files analysed: 2 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
🟠 Advisory review: Concerns worth a lookThis PR needs a human approval. Before you give it, these are the things I'd want resolved. The PR restructures payment setup request bodies to match the API spec (nesting card fields under Concerns
This is not an approval. wall-e cannot auto-approve this PR — it is an opinion to help whoever does. Advisory review · us.anthropic.claude-sonnet-4-6 · wall-e 2026.06.19-02 |
The PaymentSetup schema (POST /payments/setups, PUT and GET
/payments/setups/{id}, POST /payments/setups/{id}/confirm/{payment_method_name})
nests the card fields under payment_methods.card.details and declares the
Apple Pay and Google Pay token as an object. The SDK sent the card fields
at the top level of the card object and the wallet token as a string, so the
API ignored them.
- Card: add details (CardDetails), token (CardToken), schemes and
preferred_scheme. The flat card attributes (number, last4, bin, scheme,
expiry_month, expiry_year, name, cvv, stored, expires_on, allow_update)
are deprecated: they keep working, emit a DeprecationWarning, and store
their value under details, so it is sent where the API reads it.
- ApplePay and GooglePay: token is now a WalletToken object (id,
expires_on), the shape the API expects; the flat expires_on is deprecated
and moves under token. Add schemes and preferred_scheme.
- PaymentMethods: add auto_confirm. PaymentSetupsRequest: add metadata.
- PaymentSetupInstrument: add the read-only type.
- New enums PaymentSetupCardScheme and GooglePayPreferredScheme; card and
Apple Pay reuse PreferredSchema, whose values match.
The wallet token type change from str to object is forced by the API: a
string token was never accepted, so this ships in a minor release.
84c6e99 to
2559798
Compare
🟡 Risk Classification: MINORApproval route: AI Review + Human Approval Classification reasons
Operational gates
Files analysed: 2 wall-e 2026.06.19-02 · policy |
🔬 Debug — why this classification?Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.
Kinds:
See issue #3 for the proposal to formalise this map as Appendix A of the standards doc. wall-e 2026.06.19-02 · debug |
|



Summary
The
PaymentSetupschema nests the card fields underpayment_methods.card.detailsand types the Apple Pay and Google Pay token as an object. The SDK sent the card fields at the top level of the card object and the wallet token as a string, so the API ignored them. This adds the spec shape, keeps the old card attributes working as deprecated aliases that write into the new shape, and adds the missingauto_confirm,metadataandinstrument.type.Changes
checkout_sdk/payments/setups/setups.py:Card: addsdetails(CardDetails, the 11 card fields),token(CardToken),schemesandpreferred_scheme. The flat attributes (number,last4,bin,scheme,expiry_month,expiry_year,name,cvv,stored,expires_on,allow_update) are deprecated: they keep working, emit aDeprecationWarning, and store their value underdetails, so it is sent where the API reads it.ApplePay,GooglePay:tokenis now aWalletToken(id,expires_on). The flatexpires_onis deprecated and moves undertoken. Addsschemesandpreferred_scheme.PaymentSetupCardScheme(17 values) andGooglePayPreferredScheme(visa, mastercard). Card and Apple Pay reusePreferredSchema.PaymentMethods.auto_confirm,PaymentSetupsRequest.metadata, and the read-onlyPaymentSetupInstrument.type.Card,ApplePayandGooglePayserialize their own attributes (to_json), so each value is sent once, underdetailsortoken, and serialization never triggers the deprecation warnings.tests/payments/setups/payment_setups_serialization_test.py: literal wire keys, roundtrip and spec-shaped bodies for every new property, each deprecated attribute (sent only underdetails/token, warning emitted) and enum completeness.API Reference
POST /payments/setupsPUT /payments/setups/{id}GET /payments/setups/{id}POST /payments/setups/{id}/confirm/{payment_method_name}Breaking changes
Forced by the API, so this is a minor release, to be called out in the release notes:
ApplePay.tokenandGooglePay.tokenchange fromstrtoWalletToken. A string token was never accepted by the API, so nothing that worked stops working. Every other replaced attribute is kept as a deprecated alias.README
No change needed.