Skip to content

Commit

Permalink
add crypto payment method to payment sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzhang-stripe committed Jan 17, 2025
1 parent dbcf05a commit 30c8a8a
Show file tree
Hide file tree
Showing 19 changed files with 932 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### PaymentSheet
* [Fixed] Embedded Payment Element (private beta) layout margins default to zero.

* [Added] Support for Crypto in PaymentSheet

## 24.4.0 2025-01-13
### PaymentSheet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,22 @@ class PaymentSheetStandardLPMUIOneTests: PaymentSheetStandardLPMUICase {
XCTAssertTrue(app.staticTexts["Success!"].waitForExistence(timeout: 15.0))
}

func testCryptoPaymentMethod() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.currency = .usd
settings.merchantCountryCode = .US
loadPlayground(app, settings)
app.buttons["Present PaymentSheet"].tap()

// Select Crypto
tapPaymentMethod("Crypto")

// Pay
app.buttons["Pay $50.99"].waitForExistenceAndTap()
webviewAuthorizePaymentButton.waitForExistenceAndTap(timeout: 10)
XCTAssertTrue(app.staticTexts["Success!"].waitForExistence(timeout: 15.0))
}

func testZipPaymentMethod() throws {
var settings = PaymentSheetTestPlaygroundSettings.defaultValues()
settings.layout = .horizontal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,34 @@
}
}
}
},
},
{
"type": "crypto",
"async": false,
"selector_icon": {
"light_theme_png": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/icon-pm-crypto@3x-94c06c199e78e6d9ff9290210912bd5e.png",
"light_theme_svg": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/icon-pm-crypto-15fd4ffeafd1b13e40688c8a06d79ba4.svg",
"dark_theme_png": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/icon-pm-crypto_dark@3x-8f7b0e91b45cb56de550af37d41aac1d.png",
"dark_theme_svg": "https://js.stripe.com/v3/fingerprinted/img/payment-methods/icon-pm-crypto_dark-f19bb5c5400c6cde94dd53b7f1ce7217.svg"
},
"fields": [
],
"next_action_spec": {
"confirm_response_status_specs": {
"requires_action": {
"type": "redirect_to_url"
}
},
"post_confirm_handling_pi_status_specs": {
"succeeded": {
"type": "finished"
},
"requires_action": {
"type": "canceled"
}
}
}
},
{
"type": "mobilepay",
"async": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ extension PaymentSheet {
return []
case .alipay, .EPS, .FPX, .giropay, .grabPay, .netBanking, .payPal, .przelewy24, .klarna,
.bancontact, .iDEAL, .cashApp, .affirm, .zip, .revolutPay, .amazonPay, .alma,
.mobilePay, .swish, .twint, .sunbit, .billie, .satispay:
.mobilePay, .swish, .twint, .sunbit, .billie, .satispay, .crypto:
return [.returnURL]
case .USBankAccount:
return [
Expand All @@ -330,7 +330,7 @@ extension PaymentSheet {
return [.returnURL, .userSupportsDelayedPaymentMethods]
case .afterpayClearpay:
return [.returnURL, .shippingAddress]
case .link, .unknown, .crypto:
case .link, .unknown:
return [.unsupported]
@unknown default:
return [.unsupported]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extension PaymentSheet {
.sunbit,
.billie,
.satispay,
.crypto,
.boleto,
.swish,
.twint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ final class PaymentSheet_LPM_ConfirmFlowTests: STPNetworkStubbingTestCase {
}
}

func testCryptoConfirmFlows() async throws {
try await _testConfirm(intentKinds: [.paymentIntent],
currency: "USD",
paymentMethodType: .crypto,
merchantCountry: .US) { form in
// Crypto has no input fields
XCTAssertEqual(form.getAllUnwrappedSubElements().count, 1)
}
}

func testAlipayConfirmFlows() async throws {
try await _testConfirm(intentKinds: [.paymentIntent],
currency: "USD",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 30c8a8a

Please # to comment.