Repository navigation
fix(setups): align the payment setup request shape with the spec - #254
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 shapes to match the API spec, but the truncated diff reveals a typo ( 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 |
…deprecated fields The flat Card attributes and the wallet expires_on were deprecated properties that wrote into details and token. That redirection is not needed, since the API never read those attributes at that level, and it raised an AttributeError when token was still set as a string. They are now plain attributes documented as deprecated and ignored by the API, as they were before this change, and will be removed in the next major version. Also document excluded_payment_methods as payment method names and check the Apple Pay token_data header in the wallet roundtrip.
🟡 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 as deprecated, 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 are kept until the next major version, and their docs say the API does not read them at that level, sodetailsmust be used.ApplePay,GooglePay:tokenis now aWalletToken(id,expires_on). The flatexpires_onis deprecated in favour oftoken.expires_on. Addsschemesandpreferred_scheme.PaymentSetupCardScheme(17 values) andGooglePayPreferredScheme(visa, mastercard). Card and Apple Pay reusePreferredSchema.PaymentMethods.auto_confirm,PaymentSetupsRequest.metadata, and the read-onlyPaymentSetupInstrument.type.excluded_payment_methodsis documented as a list of payment method names.tests/payments/setups/payment_setups_serialization_test.py: literal wire keys, roundtrip and spec-shaped bodies for every new property, the deprecated attributes still being declared, the Apple Paytoken_data.headerin the wallet roundtrip, 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 attribute.README
No change needed.