Flutter SDK
1. Installation
Download the SDK
Tamara Flutter SDK
2. Setup
Using this package as a library
A. Depend on it
Run this command:
With Flutter:
$ flutter pub add tamara_flutter_sdk
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
Please note that the version should be changed to our latest version.
dependencies:
tamara_sdk: ^1.0.9
Alternatively, your editor might support flutter pub get
. Check the docs of your editor to learn more.
B. Import it
Now in your Dart code, you can use:
import 'package:tamara_flutter_sdk/tamara_checkout.dart';
import 'package:tamara_flutter_sdk/tamara_sdk.dart';
3. Using Flutter SDK
How to use it Include function:
Init: Initialize before using it:
TamaraPayment.initialize(AUTH_TOKEN, API_URL, NOTIFICATION_WEB_HOOK_URL, PUBLISH_KEY, NOTIFICATION_TOKEN, isSandbox)
Create and pay order
Before adding order information, create an Order by calling this method with referenceOrderId and description.
RefId is the unique id of your order.
TamaraPayment.createOrder(referenceOrderId, description)
These information are mandatory:
Set customer's information:
TamaraPayment.setCustomerInfo(firstName, lastName,phoneNumber, email, isFirstOrder)
Set payment type (optional: default: PAY_BY_INSTALMENTS):
TamaraPayment.setPaymentType(paymentType)
Add Item with its price, tax, and discount:
TamaraPayment.addItem(name, referenceId ,sku, type, unitPrice,taxAmount ,discountAmount, quantity)
Set shipping address and billing address:
TamaraPayment.setShippingAddress(firstName,lastName, phone,addressLine1, addressLine2, country, region, city)
TamaraPayment.setBillingAddress(firstName,lastName, phone,addressLine1, addressLine2, country, region, city)
Set shipping fee:
TamaraPayment.setShippingAmount(shippingFee)
Set discount (optional):
TamaraPayment.setDiscount(discount, name)
Set instalments:
TamaraPayment.setInstalments(instalments)
Set locale:
TamaraPayment.setLocale(locale)
Set order number:
TamaraPayment.setOrderNumber(orderNumber)
Set expires:
TamaraPayment.setExpiresInMinutes(expiresInMinutes)
Set risk assessment:
TamaraPayment.setRiskAssessments(jsonData)
Set additional data:
TamaraPayment.setAdditionalData(jsonData)
Processes to Tamara payment page using:
TamaraPayment.paymentOrder()
Order detail
Get order detail information
TamaraPayment.getOrderDetail(orderId)
Authorise order
Authorise order by calling this method with orderId.
TamaraPayment.authoriseOrder(orderId)
Cancel order
Note: Need to call authorise order method before calling cancel orderCancel order reference by calling this method with orderId and jsonData.
TamaraPayment.cancelOrder(orderId, jsonData)
Update order reference
Update order reference by calling this method with orderId and orderReference.
TamaraPayment.updateOrderReference(orderId, orderReference)
Capture a payment
TamaraPayment.getCapturePayment(jsonData)
Refund a payment
TamaraPayment.refunds(orderId, jsonData)
Render product widget
TamaraPayment.renderWidgetProduct(language, country, publicKey, amount)
Render cart widget
TamaraPayment.renderWidgetCartPage(language, country, publicKey, amount)
Updated 3 months ago