Skip to content

forcedotcom/sf-skills / plugins/builder/mobile-development/skills/mobile-platform-native-capabilities-integrate

mobile-platform-native-capabilities-integrate

Verified

Build a Salesforce LWC that uses native mobile device capabilities — barcode scanner, biometrics, location, NFC, calendar, contacts, document scanner, geofencing, AR space capture, app review, and payments. Use this skill when the user asks for an LWC that scans a barcode, captures a photo of a document, reads location or geofences, prompts for biometrics, reads/writes the device calendar or contacts, taps NFC, takes a payment, prompts for an app review, or scans an AR space. Also triggers on "lightning/mobileCapabilities", "mobile capability", "Nimbus", "device capability". Do not use for mobile offline / Komaci priming reviews (use `mobile-platform-offline-validate`) or for picking generic Lightning base components (use `design-systems-slds-apply`).

references/payments.md

View on GitHub
# Payments Service Grounding Context

The following content provides grounding information for generating a Salesforce LWC that leverages payments facilities on mobile devices. Specifically, this context will cover the API types and methods available to leverage the payments API of the mobile device, within the LWC.

## Payments Service API

```typescript
/*
 * Copyright (c) 2024, Salesforce, Inc.
 * All rights reserved.
 * For full license text, see the LICENSE.txt file
 */

import { BaseCapability } from '../BaseCapability.js';

/**
 * Use this factory function to get an instance of {@linkcode PaymentsService}.
 * @returns An instance of {@linkcode PaymentsService}.
 */
export function getPaymentsService(): PaymentsService;

/**
 * PaymentsService is a Nimbus plugin that allows JavaScript code in a Lightning web component to call functions that launches Stripe's Tap to Pay capabilities.
 */
export interface PaymentsService extends BaseCapability {
  /**
   * Process payment.
   * @param options The customization options.
   * @returns A Promise object that resolves to {@linkcode CollectPaymentResult} object.
   */
  collectPayment(options: CollectPaymentOptions): Promise<CollectPaymentResult>;

  /**
   * Get the supported payment methods on this device
   * @param options The customization options.
   * @returns  A Promise object that resolves to an array containing {@linkcode PaymentMethod} objects.
   */
  getSupportedPaymentMethods(options: GetSupportedPaymentMethodsOptions): Promise<PaymentMethod[]>;
}

/**
 * PaymentMethod values.
 */
export type PaymentMethod = 'TAP_TO_PAY' | 'CREDIT_CARD_DETAILS' | 'PAY_VIA_LINK';

/**
 * GetSupportedPaymentMethodsOptions interface.
 */
export interface GetSupportedPaymentMethodsOptions {
  countryIsoCode?: string;
  merchantAccountId?: string;
  permissionRationaleText?: string;
}

/**
 * CollectPaymentOptions interface.
 */
export interface CollectPaymentOptions {
  amount: number;
  paymentMethod: PaymentMethod;
  currencyIsoCode: string;
  merchantAccountId: string;
  merchantName: string;
  payerAccountId?: string;
  sourceObjectIds?: string[];
  permissionRationaleText?: string;
}

/**
 * CollectPaymentResult interface.
 */
export interface CollectPaymentResult {
  gatewayRefId?: string;
  guid?: string;
  paymentGatewayId?: string;
  status?: string;
}

/**
 * PaymentsServiceFailure interface.
 */
export interface PaymentsServiceFailure {
  code: PaymentsServiceFailureCode;
  message: string;
}

/**
 * Possible failure codes.
 */
export type PaymentsServiceFailureCode =
  | 'USER_DISMISSED' // User cancelled the operation.
  | 'USER_DENIED_PERMISSION' // Permission to access device location is denied.
  | 'SERVICE_NOT_ENABLED' // The service is not enabled and therefore cannot be used.
  | 'UNKNOWN_REASON'; // An error happened in the native code that is not permission based. Will give more information in the PaymentsServiceFailure message.
```
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall