Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const kt = `import com.paystack.android.core.Paystack`

const java = `import com.paystack.android.core.Paystack;`

export {kt, java}
11 changes: 11 additions & 0 deletions dist/doc/developer-tools/android-sdk/builder-library-usage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const kt = `Paystack.builder()
.setPublicKey("pk_domain_xxxxxxxx")
.setLoggingEnabled(true)
.build()`

const java = `Paystack.builder()
.setPublicKey("pk_domain_xxxxxxxx")
.setLoggingEnabled(true)
.build();`

export {kt, java}
5 changes: 5 additions & 0 deletions dist/doc/developer-tools/android-sdk/installation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const gradle = `dependencies {
implementation 'com.paystack.android:paystack-ui:0.0.5'
}`

export {gradle}
14 changes: 14 additions & 0 deletions dist/doc/developer-tools/android-sdk/payment-sheet-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const kt = `private lateinit var paymentSheet: PaymentSheet

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

paymentSheet = PaymentSheet(this) { paymentResult ->
// Handle payment result here.
}

}`

const java = `// TODO: Add snippet`

export {kt, java}
8 changes: 8 additions & 0 deletions dist/doc/developer-tools/android-sdk/payment-sheet-launch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const kt = `fun startPayment() {
val accessCode = initializeTransactionOnServer()
paymentSheet.launch(accessCode)
}`

const java = `// TODO: Add snippet`

export {kt, java}
39 changes: 39 additions & 0 deletions dist/doc/developer-tools/android-sdk/payment-sheet-result-full.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const kt = `private fun paymentComplete(paymentSheetResult: PaymentSheetResult ) {
val message = when (paymentSheetResult) {
PaymentSheetResult.Cancelled -> "Cancelled"
is PaymentSheetResult.Failed -> {
Log.e("Something went wrong", paymentSheetResult.error.message.orEmpty(), paymentSheetResult.error)
paymentSheetResult.error.message ?: "Failed"
}

is PaymentSheetResult.Completed -> {
// Returns the transaction reference PaymentCompletionDetails(reference={TransactionRef})
Log.d("Payment successful", paymentSheetResult.paymentCompletionDetails.toString())
"Successful"
}
}

Toast.makeText(this, "Payment $message", Toast.LENGTH_SHORT).show()
}`

const java = `private void onPaymentResult(PaymentSheetResult paymentResult) {
String message;
if (paymentResult instanceof PaymentSheetResult.Cancelled) {
message = "Cancelled";
} else if (paymentResult instanceof PaymentSheetResult.Failed) {
PaymentSheetResult.Failed failedResult = (PaymentSheetResult.Failed) paymentResult;
Log.e(TAG, failedResult.getError().getMessage() != null ?
failedResult.getError().getMessage() : "Failed", failedResult.getError());
message = failedResult.getError().getMessage() != null ?
failedResult.getError().getMessage() : "Failed";
} else if (paymentResult instanceof PaymentSheetResult.Completed) {
Log.d("Payment successful", paymentSheetResult.paymentCompletionDetails.toString())
message = "Successful";
} else {
message = "";
}

Toast.makeText(this, "Payment " + message, Toast.LENGTH_SHORT).show();
}`

export {kt, java}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const kt = `import com.paystack.android_sdk.ui.paymentsheet.PaymentSheetResult

private fun paymentComplete(paymentSheetResult: PaymentSheetResult ) {

}`

const java = `// TODO: Add snippet`

export {kt, java}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
languages:
- kt
- java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import com.paystack.android.core.Paystack;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import com.paystack.android.core.Paystack
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
languages:
- kt
- java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Paystack.builder()
.setPublicKey("pk_domain_xxxxxxxx")
.setLoggingEnabled(true)
.build();
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Paystack.builder()
.setPublicKey("pk_domain_xxxxxxxx")
.setLoggingEnabled(true)
.build()
2 changes: 2 additions & 0 deletions src/doc/developer-tools/android-sdk/installation/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
languages:
- gradle
3 changes: 3 additions & 0 deletions src/doc/developer-tools/android-sdk/installation/index.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies {
implementation 'com.paystack.android:paystack-ui:0.0.5'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
languages:
- kt
- java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: Add snippet
10 changes: 10 additions & 0 deletions src/doc/developer-tools/android-sdk/payment-sheet-init/index.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
private lateinit var paymentSheet: PaymentSheet

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

paymentSheet = PaymentSheet(this) { paymentResult ->
// Handle payment result here.
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
languages:
- kt
- java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: Add snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fun startPayment() {
val accessCode = initializeTransactionOnServer()
paymentSheet.launch(accessCode)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
languages:
- kt
- java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
private void onPaymentResult(PaymentSheetResult paymentResult) {
String message;
if (paymentResult instanceof PaymentSheetResult.Cancelled) {
message = "Cancelled";
} else if (paymentResult instanceof PaymentSheetResult.Failed) {
PaymentSheetResult.Failed failedResult = (PaymentSheetResult.Failed) paymentResult;
Log.e(TAG, failedResult.getError().getMessage() != null ?
failedResult.getError().getMessage() : "Failed", failedResult.getError());
message = failedResult.getError().getMessage() != null ?
failedResult.getError().getMessage() : "Failed";
} else if (paymentResult instanceof PaymentSheetResult.Completed) {
Log.d("Payment successful", paymentSheetResult.paymentCompletionDetails.toString())
message = "Successful";
} else {
message = "";
}

Toast.makeText(this, "Payment " + message, Toast.LENGTH_SHORT).show();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
private fun paymentComplete(paymentSheetResult: PaymentSheetResult ) {
val message = when (paymentSheetResult) {
PaymentSheetResult.Cancelled -> "Cancelled"
is PaymentSheetResult.Failed -> {
Log.e("Something went wrong", paymentSheetResult.error.message.orEmpty(), paymentSheetResult.error)
paymentSheetResult.error.message ?: "Failed"
}

is PaymentSheetResult.Completed -> {
// Returns the transaction reference PaymentCompletionDetails(reference={TransactionRef})
Log.d("Payment successful", paymentSheetResult.paymentCompletionDetails.toString())
"Successful"
}
}

Toast.makeText(this, "Payment $message", Toast.LENGTH_SHORT).show()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
languages:
- kt
- java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: Add snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import com.paystack.android_sdk.ui.paymentsheet.PaymentSheetResult

private fun paymentComplete(paymentSheetResult: PaymentSheetResult ) {

}