tamara_flutter_sdk 1.0.15 copy "tamara_flutter_sdk: ^1.0.15" to clipboard
tamara_flutter_sdk: ^1.0.15 copied to clipboard

Tamara Check out SDK

Flutter SDK #

Requirements #

Setup SDK #

  • Set path TamaraSDK to your project(TamaraSDK Example) Example: Add sdk to your pubspec.yaml file

dependencies: tamara_flutter_sdk: version

Install #

  • run command line TamaraSDK Example:
  • flutter clean + flutter pub get: update new library
  • cd to IOS folder-> pod install -> install library IOS for TamaraSDK and TamaraSDK Example(pod file)

##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's information, create Order by call this method with referenceOrderId and description. RefId is your unique id of your order.

TamaraPayment.createOrder(referenceOrderId, description)
copied to clipboard

These informations are mandatory: #

Set customer's information:

TamaraPayment.setCustomerInfo(firstName, lastName,
            phoneNumber, email, isFirstOrder)
copied to clipboard

Set payment type (optional: default: PAY_BY_INSTALMENTS):

TamaraPayment.setPaymentType(paymentType)
copied to clipboard

Add Item with its price, tax and discount:

TamaraPayment.addItem(name, referenceId ,sku, type, unitPrice,
                    taxAmount ,discountAmount, quantity)
copied to clipboard

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)
copied to clipboard

Set shipping fee:

TamaraPayment.setShippingAmount(shippingFee)
copied to clipboard

Set discount (optional):

TamaraPayment.setDiscount(discount, name)
copied to clipboard

Set instalments:

TamaraPayment.setInstalments(instalments)
copied to clipboard

Set locale:

TamaraPayment.setLocale(locale)
copied to clipboard

Set order number:

TamaraPayment.setOrderNumber(orderNumber)
copied to clipboard

Set expires in minutes:

TamaraPayment.setExpiresInMinutes(expiresInMinutes)
copied to clipboard

Set risk assessment:

TamaraPayment.setRiskAssessment(jsonData)
copied to clipboard

Example: bool result = await TamaraPayment.setRiskAssessment(jsonData); if (result) { //json ok }


Set additional data:
copied to clipboard

TamaraPayment.setAdditionalData(jsonData)


Add Custom Fields AdditionalData: 
Example val jsonData = "{\"custom_field1\": 42, \"custom_field2\": \"value2\" }"
copied to clipboard

TamaraPayment.addCustomFieldsAdditionalData(jsonData)


Processes to Tamara payment page using:
copied to clipboard

TamaraPayment.paymentOrder()


## Order detail
Get order detail
param mandatory: orderId
copied to clipboard

TamaraPayment.getOrderDetail(orderId)

Example:
Response: parse json data -> model
String result = await TamaraSdk.getOrderDetail(orderId);
final orderDetail = OrderDetail.fromJson(jsonDecode(result));
OrderDetail.fromJson(Map<String, dynamic> json) {
    billingAddress = json['billing_address'] != null
        ? BillingAddress.fromJson(json['billing_address'])
        : null;
    canceledAmount = json['canceled_amount'] != null
        ? CanceledAmount.fromJson(json['canceled_amount'])
        : null;
    capturedAmount = json['captured_amount'] != null
        ? CanceledAmount.fromJson(json['captured_amount'])
        : null;
    consumer =
        json['consumer'] != null ? Consumer.fromJson(json['consumer']) : null;
    countryCode = json['country_code'];
    createdAt = json['created_at'];
    description = json['description'];
    discountAmount = json['discount_amount'] != null
        ? CanceledAmount.fromJson(json['discount_amount'])
        : null;
    instalments = json['instalments'];
    if (json['items'] != null) {
      items = <Items>[];
      json['items'].forEach((v) {
        items!.add(Items.fromJson(v));
      });
    }
    orderId = json['order_id'];
    orderNumber = json['order_number'];
    orderReferenceId = json['order_reference_id'];
    paidAmount = json['paid_amount'] != null
        ? CanceledAmount.fromJson(json['paid_amount'])
        : null;
    paymentType = json['payment_type'];
    platform = json['platform'];
    refundedAmount = json['refunded_amount'] != null
        ? CanceledAmount.fromJson(json['refunded_amount'])
        : null;
    settlementStatus = json['settlement_status'];
    shippingAddress = json['shipping_address'] != null
        ? BillingAddress.fromJson(json['shipping_address'])
        : null;
    shippingAmount = json['shipping_amount'] != null
        ? CanceledAmount.fromJson(json['shipping_amount'])
        : null;
    status = json['status'];
    taxAmount = json['tax_amount'] != null
        ? CanceledAmount.fromJson(json['tax_amount'])
        : null;
    totalAmount = json['total_amount'] != null
        ? CanceledAmount.fromJson(json['total_amount'])
        : null;
    walletPrepaidAmount = json['wallet_prepaid_amount'] != null
        ? CanceledAmount.fromJson(json['wallet_prepaid_amount'])
        : null;
  }

## Authorise order
Authorise order by call this method with orderId.
param mandatory: orderId
copied to clipboard

TamaraPayment.authoriseOrder(orderId)

Example:
Response:
String result = await TamaraSdk.authoriseOrder(orderId);
final authoriseOrder = AuthoriseOrder.fromJson(jsonDecode(result));
AuthoriseOrder.fromJson(Map<String, dynamic> json) {
    autoCaptured = json['auto_captured'];
    orderExpiryTime = json['order_expiry_time'];
    orderId = json['order_id'];
    paymentType = json['payment_type'];
    status = json['status'];
  }

## Cancel order
Note: Need call authorise order method before call cancel order
Cancel order reference by call this method with orderId and jsonData.

param mandatory: orderId
jsonData: use library convert class CancelOrderRequest to json (Gson)
copied to clipboard

TamaraPayment.cancelOrder(orderId, jsonData)

Example:
Response:
copied to clipboard

final cancelOrder = CancelOrder.fromJson(jsonDecode(result));

Update order reference #

Update order reference by call this method with orderId and orderReference.

param mandatory: orderId, orderReference

TamaraPayment.updateOrderReference(orderId, orderReference)
copied to clipboard

Example:

Response:
final orderReference = OrderReference.fromJson(jsonDecode(result));
OrderReference.fromJson(Map<String, dynamic> json) {
    message = json['message'];
  }
copied to clipboard

Capture a payment #

Note: Need call authorise order method before call capture a payment Cancel order reference by call this method with orderId and jsonData.

param mandatory: orderId jsonData: use library convert class Capture to json (Gson)

TamaraPayment.getCapturePayment(jsonData)
copied to clipboard

Example: Response: TamaraSdk.getCapturePayment(jsonEncode(capture.toJson())); Capture.fromJson(Map<String, dynamic> json) { orderId = json['order_id']; totalAmount = EAmount.fromJson(json['total_amount']); taxAmount = EAmount.fromJson(json['tax_amount']); shippingAmount = EAmount.fromJson(json['shipping_amount']); discountAmount = EAmount.fromJson(json['discount_amount']); if (json['items'] != null) { items =

Refunds #

Cancel order reference by call this method with orderId and jsonData. Note: Need call authorise order method before call Refunds

param mandatory: orderId jsonData: use library convert class Refund to json (Gson)

TamaraPayment.refunds(orderId, jsonData)
copied to clipboard

Example: Response: Refund refund = Refund(totalAmount: totalAmount, comment: comment); final result = await TamaraSdk.refunds(orderId, jsonEncode(refund));

Render widget cart page #

Render widget cart page reference by call this method with language, country, publicKey, amount. param mandatory: language, country, publicKey, amount

TamaraPayment.renderWidgetCartPage(language, country, publicKey, amount)
copied to clipboard

Example: Response: String result = await TamaraSdk.renderCartPage(language, country, publicKey, amount); final cartPage = CartPage.fromJson(jsonDecode(result));

CartPage.fromJson(Map<String, dynamic> json) { script = json['script']; url = json['url']; }

Render widget product #

Render widget product reference by call this method with language, country, publicKey, amount. param mandatory: language, country, publicKey, amount

TamaraPayment.renderWidgetProduct(language, country, publicKey, amount)
copied to clipboard

Example: Response: String result = await TamaraSdk.renderProduct(language, country, publicKey, amount); Product product = Product.fromJson(jsonDecode(result));

Product.fromJson(Map<String, dynamic> json) { script = json['script']; url = json['url']; }

5
likes
110
points
166
downloads

Publisher

verified publishertamara.co

Weekly Downloads

2024.09.16 - 2025.03.31

Tamara Check out SDK

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

auto_size_text_field, flutter, fluttertoast, permission_handler, webview_flutter

More

Packages that depend on tamara_flutter_sdk