Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@projektionisten/capacitor-braintree
Advanced tools
The Braintree API provides methods for sharing content in any sharing-enabled apps the user may have installed.
The Braintree Drop-in UI is a self contained overlay for using different types of payment providers in your app.
yarn add @projektionisten/capacitor-braintree
npx cap sync
For the paypal browser flow to work, you need to add this overload to the MainActivity of your android project
@Override
protected void onNewIntent(Intent newIntent) {
super.onNewIntent(newIntent);
setIntent(newIntent);
}
Also, an intent-filter for returning into the app needs to be defined. The ${applicationId}
does not need to be replaced by anything, it automatically inserts the package name of the application
Beware: If your package name includes special characters like an _underscore, the intent filter is not going to work and you have to replace ${applicationId}
with a version of your package name with the special characters removed. For example, if your package name is com.package_name.example
, the scheme would have to be com.packagename.example.braintree
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="${applicationId}.braintree" />
</intent-filter>
If you want to enable GooglePay, you also need to add this meta tag to the application element in your Manifest file
<meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true"/>
setClientToken(...)
startPaypalPayment(...)
startApplePayPayment(...)
startGooglePayPayment(...)
isGooglePayReady()
isApplePayReady()
setClientToken(options: TokenOptions) => Promise<void>
This updates the plugin with a new auth token.
This needs to be called before the SDK can be used.
Param | Type |
---|---|
options | TokenOptions |
startPaypalPayment(options: PaypalPaymentOptions) => Promise<PaymentUIResult>
Starts a transaction with the paypal sdk. Will open a seperate browser window or similar to complete and return with information about the used account and the payment nonce
Param | Type |
---|---|
options | PaypalPaymentOptions |
Returns: Promise<PaymentUIResult>
startApplePayPayment(options: ApplePaymentOptions) => Promise<PaymentUIResult>
Starts a transaction with the apple pay sdk. Will open a seperate browser window or similar to complete and return with information about the used account and the payment nonce
Param | Type |
---|---|
options | ApplePaymentOptions |
Returns: Promise<PaymentUIResult>
startGooglePayPayment(options: GooglePaymentOptions) => Promise<PaymentUIResult>
Starts a transaction with the google pay sdk. Will open a seperate browser window or similar to complete and return with information about the used account and the payment nonce
Param | Type |
---|---|
options | GooglePaymentOptions |
Returns: Promise<PaymentUIResult>
isGooglePayReady() => Promise<PaymentMethodReadyResult>
Google pay specifically offers a method to wait for it to be ready to use. Returns a promise that resolves when it is ready.
Returns: Promise<PaymentMethodReadyResult>
isApplePayReady() => Promise<PaymentMethodReadyResult>
Check if apple pay is available on this device
Returns: Promise<PaymentMethodReadyResult>
Options for setting up payment tokens
Prop | Type | Description | Default |
---|---|---|---|
token | string | The token to be used | |
env | 'development' | 'production' | Environment for the payment providers. Currently only used by the google pay client in the *WEBimplementation. When env is 'development', the google pay client will use the TEST config, accessing only the sandbox. | 'production' |
Successful callback result for the payment methods.
Prop | Type | Description |
---|---|---|
userCancelled | boolean | Indicates if the user used the cancel button to close the dialog without completing the payment. |
nonce | string | The nonce for the payment transaction (if a payment was completed). |
type | string | The payment type (if a payment was completed). |
localizedDescription | string | A description of the payment method (if a payment was completed). |
card | { lastTwo: string; network: CREDIT_CARD_NETWORK; } | Information about the credit card used to complete a payment (if a credit card was used). |
paypalAccount | { email: string; firstName?: string; lastName?: string; phone?: string; billingAddress?: string; shippingAddress?: string; clientMetadataId?: string; payerId?: string; } | Information about the PayPal account used to complete a payment (if a PayPal account was used). |
threeDSecureCard | { liabilityShifted: boolean; liabilityShiftPossible: boolean; } | Information about 3D Secure card used to complete a payment (if 3D Secure was used). |
Options for the payment methods.
Prop | Type | Description | Default |
---|---|---|---|
amount | string | The amount of the transaction to show in the drop-in UI on the summary row as well as the call to action button. | |
primaryDescription | string | The description of the transaction to show in the drop-in UI on the summary row. | |
paymentFlow | PAYPAL_PAYMENT_FLOW | Type of payment flow. Either an one-time checkout or a vaulted payment, for easier transactions in the future | PAYPAL_PAYMENT_FLOW.CHECKOUT |
userAction | PAYPAL_USER_ACTION | Defines the type of call to action button the user clicks to return to the shop. By default, the call to action button will imply that there is a checkout with a final price after the user authorization. Use PAYPAL_USER_ACTION.COMMIT if it should be a final "pay now" button. | PAYPAL_USER_ACTION.CONTINUE_TO_CHECKOUT |
Options for the payment methods.
Prop | Type | Description | Default |
---|---|---|---|
amount | string | The amount of the transaction to show in the drop-in UI on the summary row as well as the call to action button. | |
currencyCode | string | ISO 4217 code of the currency used, like 'EUR' or 'USD' | 'EUR' |
countryCode | string | ISO 3166 code of the merchants country, like 'DE' or 'US'. Defaults to the settings in your braintree backend | |
primaryDescription | string | The description of the transaction to show in the drop-in UI on the summary row. |
Options for the payment methods.
Prop | Type | Description | Default |
---|---|---|---|
merchantId | string | Merchant ID to use for this transaction if it differs from the one in your braintree account | |
amount | string | The amount of the transaction to show in the drop-in UI on the summary row as well as the call to action button. | |
amountStatus | 'ESTIMATED' | 'FINAL' | Is the price already the final one to be paid, or will potential sales taxes or shipping prices be added later in the checkout | 'FINAL' |
currencyCode | string | ISO 4217 code of the currency used, like 'EUR' or 'USD' | 'EUR' |
Result for a method that checks if a given payment method is ready to be used
Prop | Type |
---|---|
ready | boolean |
Members | Value |
---|---|
UNKNOWN | 'BTCardNetworkUnknown' |
AMEX | 'BTCardNetworkAMEX' |
DINERS_CLUB | 'BTCardNetworkDinersClub' |
DISCOVER | 'BTCardNetworkDiscover' |
MASTER_CARD | 'BTCardNetworkMasterCard' |
VISA | 'BTCardNetworkVisa' |
JCB | 'BTCardNetworkJCB' |
LASER | 'BTCardNetworkLaser' |
MAESTRO | 'BTCardNetworkMaestro' |
UNION_PAY | 'BTCardNetworkUnionPay' |
SOLO | 'BTCardNetworkSolo' |
SWITCH | 'BTCardNetworkSwitch' |
UK_MAESTRO | 'BTCardNetworkUKMaestro' |
Members | Value |
---|---|
CHECKOUT | 'checkout' |
VAULT | 'vault' |
Members | Value |
---|---|
CONTINUE_TO_CHECKOUT | 'continue' |
COMMIT | 'commit' |
FAQs
The Braintree API provides methods for sharing content in any sharing-enabled apps the user may have installed.
We found that @projektionisten/capacitor-braintree demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.