cancel
Showing results for 
Search instead for 
Did you mean: 

Credit Card payment authorization

Former Member
0 Kudos

I'm trying to pass credit card authorization manually using BAPI structure BAPICCARD while create sales order using BAPI_SALESORDER_CREATEFROMDAT2. what are the fields that are required to achieve this? I tried something like this where all inputs are from a parameter on screen unless specified otherwise.

order_ccard-cc_type = p_ccins.

order_ccard-cc_number = p_ccard.

order_ccard-cc_valid_t = p_datbi.

order_ccard-cc_name = p_ccname.

order_ccard-billamount = p_amount.

order_ccard-auth_flag = p_auth.

order_ccard-authamount = p_autamt.

order_ccard-currency = 'USD'.

order_ccard-curr_iso = 'USD'.

order_ccard-auth_date = p_authdt.

order_ccard-auth_time = sy-uzeit.

order_ccard-auth_cc_no = p_authcc.

order_ccard-auth_refno = p_autref.

order_ccard-cc_react = p_react.

*order_ccard-cc_re_amount

*order_ccard-gl_account

order_ccard-cc_stat_ex = p_ccall.

order_ccard-cc_react_t = p_text.

*order_ccard-virt_card =

*order_ccard-merchidcl

order_ccard-pre_auth = 'X'.

*order_ccard-cc_seq_no

*order_ccard-amountchan

order_ccard-authortype = p_ccaua.

*order_ccard-dataorigin

*order_ccard-radrcheck1

*order_ccard-radrcheck2

*order_ccard-radrcheck3

*order_ccard-rcardcheck

APPEND order_ccard.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

The field required for this is

1. customer ie sold to party

2. sales area

3. credit control area

4. payment guarantee procedure.

thanks

Kuntla

Former Member
0 Kudos

Dear Kuntla,

I'm passing all other BAPI structure fields that are mandatory though i did not show them in my message. The BAPI is working fine when i dont pass the authorization type as manual, but the problem is the order gets created with new authorization than the one i'm trying to pass. so it has something to do with the structure BAPICCARD fields only.

former_member202002
Active Participant
0 Kudos

Siva,

It might be that you're passing the wrong value in the AUTH_FLAG field. This field indicates whether you are passing in an authorization received already, or if you want the system to attempt a new authorization.

If you want to indicate that you are passing in an authorization received already you should set AUTH_FLAG = 'X'.

If you want to indicate that you are passing in credit card information which the system should use to obtain a new authorization you should leave AUTH_FLAG blank.

I hope that helps!

Regards,

Eric Bushman

VP, Solutions Engineering

Paymetric

Former Member
0 Kudos

Eric,

If you notice my code piece, I'm already passing the field AUTH_FLAG via the parameter p_auth which is a checkbox in my selection screen.

rgds,

siva

former_member202002
Active Participant
0 Kudos

Siva,

Yes, I did see that, but the only fields in your code piece in which you give any indication of what you're actually passing is the PRE_AUTH flag (you're passing a hardcoded 'X') and the two currency fields (you're passing a hardcoded 'USD').

Perhaps if you restated your code piece and instead of listing your variables you list example values that are being passed that would make it easier to diagnose the issue.

One question that would help resolve for me is if you are trying to pass in an authorization for $1.00 or if it is a larger amount. If it is a larger amount then setting the PRE_AUTH flag to 'X' may be causing the problem.

I look forward to seeing your new code snippet.

Regards,

Eric Bushman

VP, Solutions Engineering

Paymetric

Former Member
0 Kudos

Eric,

I cannot give the credit card number, validity date, type, card holder name etc here. hope you understand that. Assuming that all values are passed in through parameters , can you send me a sample code that I can copy? Answering to your question if I 'm passing $ 1.00 amount or larger, in the actual scenario where I use the code I do pass a larger amount (the order amount basically) but i aslo tested the code outside of the intended place passing $ 1.00 amount but the behaviour was no different.By the way, we have some notes issue that gives a short dump. We are in the process of fixing that first. I'll respond after that. Meanwhile, if you can look or find something let me know.

Thanks,

Siva

former_member202002
Active Participant
0 Kudos

Siva,

If you are using a real credit card for testing you should reconsider - that is not a good practice. Try using this test card number:

CARD TYPE: VISA

CARD NUMBER: 4444333322221111

EXPIRATION DATE: 10/10

CARDHOLDER NAME: TEST CUSTOMER

Now, I would certainly expect that the rest of the parameters are not sensitive and that you could share them.

Also, I don't have any sample code for the BAPI - I've always just created the test data in SE37 and never created a document. That's why it would be very helpful to see all of the data you are passing rather than your code.

What version of R/3 or ECC are you currently running?

Regards,

Eric Bushman

Vice President, Solutions Engineering

[Paymetric|https://www.paymetric.com]

Former Member
0 Kudos

Hi Eric,

We also have a project coming up which requires implementation of credit card functionality ,If you have any document which explains me of the credit card functionality in SAP .

Any link etc...

Regards

Kiran

Former Member
0 Kudos

Eric,

Thanks for the info. I have given the test program source code that I'm trying to use. Feel free to modify as you think and see that it works.

&----


*& Report YTSTCCARDAUTH

*&

&----


*&

*&

&----


REPORT ytstccardauth.

DATA: order_header_in TYPE bapisdhd1,

order_header_inx TYPE bapisdhd1x,

salesdocument TYPE bapivbeln-vbeln,

return TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE,

order_items_in TYPE STANDARD TABLE OF bapisditm WITH HEADER LINE,

order_items_inx TYPE STANDARD TABLE OF bapisditmx WITH HEADER LINE,

order_partners TYPE STANDARD TABLE OF bapiparnr WITH HEADER LINE,

order_schedules_in TYPE STANDARD TABLE OF bapischdl WITH HEADER LINE,

order_schedules_inx TYPE STANDARD TABLE OF bapischdlx WITH HEADER LINE,

order_ccard TYPE STANDARD TABLE OF bapiccard WITH HEADER LINE.

DATA: lv_valid_to TYPE bapi_field-date,

wa_bapiccard_auth_in TYPE bapiccard_auth_in,

wa_bapiccard_auth_ex TYPE bapiccard_auth_ex.

PARAMETERS: p_purch TYPE bstkd OBLIGATORY,

p_ccins TYPE fpltc-ccins OBLIGATORY,

p_ccard TYPE fpltc-ccnum OBLIGATORY,

p_datbi TYPE ccdate-exdatbi OBLIGATORY,

p_ccname TYPE fpltc-ccname," OBLIGATORY,

p_amount TYPE fpltc-autwv," OBLIGATORY,

p_auth AS CHECKBOX DEFAULT 'X',

p_autamt TYPE fpltc-autwr,

p_authdt TYPE fpltc-audat,

p_authcc TYPE fpltc-aunum,

p_autref TYPE fpltc-autra,

p_react TYPE fpltc-react,

p_ccall TYPE fpltc-ccall,

p_text TYPE fpltc-rtext,

p_preaut TYPE fpltc-ccpre,

p_ccaua TYPE fpltc-ccaua,

p_getaut RADIOBUTTON GROUP rad1,

p_crtord RADIOBUTTON GROUP rad1.

IF p_getaut IS INITIAL.

order_header_in-doc_type = 'OR'.

order_header_in-sales_org = '0001'.

order_header_in-distr_chan = '01'.

order_header_in-division = '01'.

order_header_in-po_method = 'WEB'.

order_header_in-purch_no_c = p_purch.

order_header_inx-doc_type = 'X'.

order_header_inx-sales_org = 'X'.

order_header_inx-distr_chan = 'X'.

order_header_inx-division = 'X'.

order_header_inx-po_method = 'X'.

order_header_inx-purch_no_c = 'X'.

order_items_in-itm_number = '000010'.

order_items_in-material = '893NCCL'.

order_items_in-target_qty = 10.

APPEND order_items_in.

order_items_inx-itm_number = '000010'.

order_items_inx-material = 'X'.

order_items_inx-target_qty = 'X'.

APPEND order_items_inx.

order_partners-partn_role = 'SP'.

order_partners-partn_numb = '0001270034'.

APPEND order_partners.

order_schedules_in-itm_number = '000010'.

order_schedules_in-sched_line = '0001'.

order_schedules_in-req_date = sy-datum.

order_schedules_in-req_qty = 1.

APPEND order_schedules_in.

order_schedules_inx-itm_number = '000010'.

order_schedules_inx-sched_line = '0001'.

order_schedules_inx-req_date = 'X'.

order_schedules_inx-req_qty = 'X'.

APPEND order_schedules_inx.

order_ccard-cc_type = p_ccins.

order_ccard-cc_number = p_ccard.

order_ccard-cc_valid_t = p_datbi.

order_ccard-cc_name = p_ccname.

order_ccard-billamount = p_amount.

order_ccard-auth_flag = p_auth.

order_ccard-authamount = p_autamt.

*order_ccard-currency = 'USD'.

*order_ccard-curr_iso = 'USD'.

order_ccard-auth_date = p_authdt.

*order_ccard-auth_time = sy-uzeit.

order_ccard-auth_cc_no = p_authcc.

order_ccard-auth_refno = p_autref.

order_ccard-cc_react = p_react.

*order_ccard-cc_re_amount

*order_ccard-gl_account

order_ccard-cc_stat_ex = p_ccall.

order_ccard-cc_react_t = p_text.

*order_ccard-virt_card =

*order_ccard-merchidcl

order_ccard-pre_auth = p_preaut.

*order_ccard-cc_seq_no

*order_ccard-amountchan

order_ccard-authortype = p_ccaua.

*order_ccard-dataorigin

*order_ccard-radrcheck1

*order_ccard-radrcheck2

*order_ccard-radrcheck3

*order_ccard-rcardcheck

APPEND order_ccard.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

  • salesdocumentin = salesdocumentin

order_header_in = order_header_in

order_header_inx = order_header_inx

  • sender = sender

  • binary_relationshiptype = binary_relationshiptype

  • int_number_assignment = int_number_assignment

  • behave_when_error = behave_when_error

  • logic_switch = logic_switch

  • testrun = testrun

convert = 'X'

IMPORTING

salesdocument = salesdocument

TABLES

return = return

order_items_in = order_items_in

order_items_inx = order_items_inx

order_partners = order_partners

order_schedules_in = order_schedules_in

order_schedules_inx = order_schedules_inx

  • order_conditions_in = order_conditions_in

  • order_conditions_inx = order_conditions_inx

  • order_cfgs_ref = order_cfgs_ref

  • order_cfgs_inst = order_cfgs_inst

  • order_cfgs_part_of = order_cfgs_part_of

  • order_cfgs_value = order_cfgs_value

  • order_cfgs_blob = order_cfgs_blob

  • order_cfgs_vk = order_cfgs_vk

  • order_cfgs_refinst = order_cfgs_refinst

order_ccard = order_ccard.

  • order_text = order_text

  • order_keys = order_keys

  • extensionin = extensionin

  • partneraddresses = partneraddresses.

IF NOT salesdocument IS INITIAL.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

IF p_ccaua EQ 'A'.

WRITE : 'Sales order ', 15 salesdocument, ' created with pre-authorization'.

ELSE.

WRITE : 'Sales order ', 15 salesdocument, ' created with auto-authorization'.

ENDIF.

ELSE.

LOOP AT return.

WRITE: return-type, 10 return-message.

ENDLOOP.

ENDIF.

ELSE.

CONCATENATE p_datbi+4(2) p_datbi(4) INTO lv_valid_to SEPARATED BY '/'.

CONDENSE lv_valid_to NO-GAPS.

wa_bapiccard_auth_in-cc_type = p_ccins.

wa_bapiccard_auth_in-cc_number = p_ccard.

wa_bapiccard_auth_in-cc_valid_to = lv_valid_to.

wa_bapiccard_auth_in-payment_amount = p_autamt.

wa_bapiccard_auth_in-currency = 'USD'.

CALL FUNCTION 'BAPI_CREDITCARD_AUTHORIZATION'

EXPORTING

salesorganization = '0001'

creditcarddatain = wa_bapiccard_auth_in

IMPORTING

responseofauth = wa_bapiccard_auth_ex

TABLES

return = return

EXCEPTIONS

OTHERS = 8.

IF wa_bapiccard_auth_ex-cc_autth_no IS INITIAL AND

wa_bapiccard_auth_ex-auth_refno IS INITIAL.

WRITE: 'Credit card not authrorized'.

ELSEIF wa_bapiccard_auth_ex-cc_autth_no IS INITIAL AND

wa_bapiccard_auth_ex-auth_refno IS NOT INITIAL.

WRITE: 'Credit card not authrorized'.

ELSE.

WRITE: 'Authorization number:' , wa_bapiccard_auth_ex-cc_autth_no,

/ 'Authorization refno:', wa_bapiccard_auth_ex-auth_refno,

/ 'Authorized amount:', wa_bapiccard_auth_ex-authamount.

ENDIF.

ENDIF.

***********************************************************************************

Thanks,

siva

Former Member
0 Kudos

Hi Kiran,

You asked the right person. Eric Bushman is from Paymetrics, the people who deal with credit card processing. We also use their XIPAY.

former_member202002
Active Participant
0 Kudos

Currently Paymetric's configuration guide for Payment Card Processing is not available on our website. I'd be happy to send it to you if you contact me directly.

Regards,

Eric Bushman

VP, Solutions Engineering

[Paymetric|https://www.paymetric.com]

Former Member
0 Kudos

Eric,

The problem is solved after we fixed the issue with some notes. I'm able to create orders passing manual credit card authorization.

Thanks for everyone who responded this question.

Siva

former_member202002
Active Participant
0 Kudos

Siva,

Excellent news - congrats!

Out of curiosity, what notes were applied and what problem did it correct?

Regards,

Eric Bushman

VP, Solutions Engineering

[Paymetric|http://www.paymetric.com]

Former Member
0 Kudos

Erir,

We did not apply any notes to solve the issue, but actually one of the notes applied earlier was the issue. If you remember, I had stated we are getting short dumps when we try to pass manual authorization. This was due to the error is the source code that was modified by a note earlier. There was an attempt made within the source code to pass a character value to a target field that was defined as type DEC. The structure BAPICCARDM has a field CC_LIMIT which is defined as type DEC 9 long. There was also another field CC_LIMITED which is of type CHAR 1 long which was not in the structure and the source was commented for this field replacing it with CC_LIMIT instead of CC_LIMITED. We manually added this to the structure and revived the source code change back to use CC_LIMITED instead of CC_LIMIT and this solved the problem. sound strange? But it is true.

Siva

former_member202002
Active Participant
0 Kudos

Siva,

Yes, that makes perfect sense. Finding something like that when applying OSS notes is indeed difficult. Congratulations on actually finding it and getting your BAPI interface working!

Regards,

Eric Bushman

VP, Solutions Engineering

[Paymetric|https://www.paymetric.com]

0 Kudos

Hi Eric,

I also have question related to integration of Paymatric with SAP via XIPAY.

Currently customer have credit cards scenarios and it is working fine.

Now we are going implement credit management with credit cards.

Problem we are facing while I am creating sales order into SAP and saving the same system is not going for authorization in paymatric automatically.

I have push authorization manually through transaction.

Can anyone help me how I can achieve to do authorization in run time while I am creating the sales order in SAP.


Regards,

Chirag