B4A Library SumUp mobile Payment

Hi guys,

thanks for all information and help in this forum.

Special thank to Erel for his fantastic work.

So here it is my part for the b4a-community.

This is an example to pay with the api from SumUp.

Please let me know, if it works fine for you

Best regards from Germany

Roland

PS: It it very importent to work exatly with the Package-Name, PaymentResult-Activity and the
entry in the Manifest-Editor!
 

Attachments

  • SumUpExample.zip
    11.2 KB · Views: 588
  • SumUp_Lib_1.00.zip
    4.6 KB · Views: 568

PhiloSophical

Member
Licensed User
Longtime User
Which getExtra I've to use to get the transaction code?
Log(Activity.GetStartingIntent.ExtrasToString)
looks like this:-
Bundle[{Result=1, smp-tx-code=TEDUKGHEZD, ReceiptSend=true, Response=Transaction successful., smp-receipt-sent=true, smp-result-code=1, smp-message=Transaction successful., transactionCode=TEDUKGHEZD}]

@NeverGiveUp2 - thank you so much for this code example - brilliant! Still works after 7 years! I discovered yesterday - Thank you forum!
 

udg

Expert
Licensed User
Longtime User
Hi all,

suddenly my app, using this very useful lib, doesn't work anymore.
What's new since last working session? Well, Android updated itself to version 12 and I corrected a minor bug in a section not related to SumUp. Another difference is that I had to pair a new SumUp Air device to SumUp's own app installed on the tablet.

What happens when I ask for a payment? A short message informs me that it's not possible to find a SumUp app on the tablet and offers to search for it on the Google Store. Obviously the app is there (on the tablet) but, even downloading it again, I have no success and the messagge shows again and again..

Could it be that my app (or the lib itself) needs now (due to Android 12) make use of any special permission?

Can anyone using this lib check with his/het app? Thank you

udg

Note: I posted on the original old thread because I believe it's the official one. No problem to start a new one linking to it, if needed
 

PhiloSophical

Member
Licensed User
Longtime User
Hi,

I used the same library for a while and then started to run into problems with sumup's app. They changed stuff. What I did was to look at the library code from @NeverGiveUp2 (Thank you Roland!) and realised that it was only passing parameters via an intent which B4X can control directly. I can make 2 different API versions of sumup's releases work. They are very similar but the devil is in the detail. It took me ages to figure this all out!

Don't forget the manifest change!

Hope this helps and it works for you, and if it does you may feel a bit more in control in case sumup's app changes again

snippet:
Sub B4Xforumexample
    Dim r As Reflector
    Dim api As Int = r.GetStaticField("android.os.Build$VERSION", "SDK_INT")
    Log("api="&api)
    Dim in As Intent
    If api > 22 Then
        'make sure this is in the MANIFEST - has no adverse effect for earlier versions
        '<action android:name="android.intent.action.VIEW"/> '<--- DIFFERENT
        
    
        'sumup version 2.54.3 onwards android 6+
        in.Initialize(in.ACTION_VIEW,"sumupmerchant://pay/1.0") '<--- DIFFERENT
        in.Flags=268435456
        in.PutExtra("affiliateKey","your sumup affiliate key")
        in.PutExtra("app-id","yourpackagename")
        in.PutExtra("ResponseActivity","yourpackagename.paymentresult")
        in.PutExtra("title","Your Title") '<--- DIFFERENT
        in.PutExtra("currency","GBP")
        in.PutExtra("ProductTotal","your charge") 'producttotal or total works for 2.54.3
        in.PutExtra("ReceiptEmailAddress","your receipt email")
        in.PutExtra("ReceiptPhoneNumber","your receipt phone" )
        in.Action="com.SumUp.LoadSumUpPayments"
    Else
        'sumup version 2.53.2 and earlier android 4 (maybe 5 too)
        in.Initialize("com.SumUp.LoadSumUpPayments","sumup://sumup.com/payments/")
        in.Flags=268435456
        in.PutExtra("AffiliateKey","your sumup affiliate key")
        in.PutExtra("AppID","yourpackagename")
        in.PutExtra("ResponseActivity","yourpackagename.paymentresult")
        in.PutExtra("ProductTitle","Your Title")
        in.PutExtra("Currency","GBP")
        in.PutExtra("ProductTotal","your charge")
        in.PutExtra("ReceiptEmailAddress","your receipt email")
        in.PutExtra("ReceiptPhoneNumber","your receipt phone" )
        in.Action="com.SumUp.LoadSumUpPayments"
    End If
    StartActivity(in)
End Sub
 
  • Like
Reactions: udg

udg

Expert
Licensed User
Longtime User
Thank you very much. I'll test it as soon as possible and report back here.
It will take some time because the equipment isn't mine.

Edit: @PhiloSophical . The original lib by Roland sported an AddeitionalInfo parameter. It was a map and was passed as the seventh parameter when calling function SumPay in his lib. Can you retrieve its name (or publish here the reference link) for the two versions of the direct calling you make to the SumUp app? Thank you.
 
Last edited:

menneaduplo

Member
Licensed User
Longtime User
Hi All,
My app also showed the same problem on Android 12.
Unfortunately, even with the PhiloSophical method the message always appears
Activity not found for action: <ProjectName>.paymentresult
 

DonManfred

Expert
Licensed User
Longtime User
Top